From e09e9d189bc2d31dc365a3d846a09086317350b6 Mon Sep 17 00:00:00 2001 From: "David S. Miller" Date: Mon, 26 Dec 2011 14:41:55 -0500 Subject: 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 Signed-off-by: David S. Miller --- net/unix/diag.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'net/unix') diff --git a/net/unix/diag.c b/net/unix/diag.c index 39e44c98176..c5bdbcb1c30 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); -- cgit v1.2.3