From: Colin Ian King Date: Thu, 17 Aug 2017 22:14:58 +0000 (+0100) Subject: irda: do not leak initialized list.dev to userspace X-Git-Tag: v3.18.68~18 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69e12f86c34a54bffba6480c22326e97c661ff2e;p=linux irda: do not leak initialized list.dev to userspace [ Upstream commit b024d949a3c24255a7ef1a470420eb478949aa4c ] list.dev has not been initialized and so the copy_to_user is copying data from the stack back to user space which is a potential information leak. Fix this ensuring all of list is initialized to zero. Detected by CoverityScan, CID#1357894 ("Uninitialized scalar variable") Signed-off-by: Colin Ian King Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 1cc2b7b58ab1..556e3b0f77ba 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c @@ -2251,7 +2251,7 @@ static int irda_getsockopt(struct socket *sock, int level, int optname, { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); - struct irda_device_list list; + struct irda_device_list list = { 0 }; struct irda_device_info *discoveries; struct irda_ias_set * ias_opt; /* IAS get/query params */ struct ias_object * ias_obj; /* Object in IAS */