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>
This commit is contained in:
David S. Miller 2011-12-26 14:41:55 -05:00
parent 3b0723c12e
commit e09e9d189b
1 changed files with 1 additions and 2 deletions

View File

@ -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);