Skip to content

Commit

Permalink
unix: If we happen to find peer NULL when diag dumping, write zero.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Dec 26, 2011
1 parent 3b0723c commit e09e9d1
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/unix/diag.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e09e9d1

Please sign in to comment.