From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: xemul@parallels.com, netdev@vger.kernel.org
Subject: Re: [PATCH] unix_diag: Fix incoming connections nla length
Date: Mon, 26 Dec 2011 14:42:45 -0500 (EST) [thread overview]
Message-ID: <20111226.144245.1639855054069401229.davem@davemloft.net> (raw)
In-Reply-To: <1324928172.2599.3.camel@edumazet-laptop>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 26 Dec 2011 20:36:12 +0100
> if (peer)
> buf[i++] = sock_i_ino(peer);
>
> So we probably leak kernel memory content to user for the (!peer) case,
> since we did :
>
> UNIX_DIAG_PUT(nlskb, UNIX_DIAG_ICONS,
> sk->sk_receive_queue.qlen * sizeof(u32));
I just commited the following fix for this, it probably takes less
effort to post a patch for this kind of bug than explain it don't
you think? :)
--------------------
unix: If we happen to find peer NULL when diag dumping, write zero.
Otherwise we leave uninitialized kernel memory in there.
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
net/unix/diag.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 39e44c9..c5bdbcb 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -86,8 +86,7 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb)
*/
unix_state_lock_nested(req);
peer = unix_sk(req)->peer;
- if (peer)
- buf[i++] = sock_i_ino(peer);
+ buf[i++] = (peer ? sock_i_ino(peer) : 0);
unix_state_unlock(req);
}
spin_unlock(&sk->sk_receive_queue.lock);
--
1.7.7.4
prev parent reply other threads:[~2011-12-26 19:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-25 19:58 [PATCH] unix_diag: Fix incoming connections nla length Pavel Emelyanov
2011-12-26 19:08 ` David Miller
2011-12-26 19:36 ` Eric Dumazet
2011-12-26 19:42 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111226.144245.1639855054069401229.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=xemul@parallels.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).