unix_diag: Fix incoming connections nla length
authorPavel Emelyanov <xemul@parallels.com>
Mon, 26 Dec 2011 19:08:47 +0000 (14:08 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 26 Dec 2011 19:08:47 +0000 (14:08 -0500)
The NLA_PUT macro should accept the actual attribute length, not
the amount of elements in array :(

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/unix/diag.c

index 91d57828499c6ec0f3887dec8a0a94ec8ffa1739..39e44c98176a71b5f85110fb4eebc47f9ff2826a 100644 (file)
@@ -72,7 +72,8 @@ static int sk_diag_dump_icons(struct sock *sk, struct sk_buff *nlskb)
 
        if (sk->sk_state == TCP_LISTEN) {
                spin_lock(&sk->sk_receive_queue.lock);
-               buf = UNIX_DIAG_PUT(nlskb, UNIX_DIAG_ICONS, sk->sk_receive_queue.qlen);
+               buf = UNIX_DIAG_PUT(nlskb, UNIX_DIAG_ICONS,
+                               sk->sk_receive_queue.qlen * sizeof(u32));
                i = 0;
                skb_queue_walk(&sk->sk_receive_queue, skb) {
                        struct sock *req, *peer;