[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1358953427.12374.792.camel@edumazet-glaptop>
Date: Wed, 23 Jan 2013 07:03:47 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: netdev@...r.kernel.org, Yannick Koehler <yannick@...hler.name>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [Patch net] unix: correct sk_rmem_alloc accounting
On Wed, 2013-01-23 at 22:43 +0800, Cong Wang wrote:
> From: Cong Wang <xiyou.wangcong@...il.com>
>
> Yannick reported [1] we probably forgot to account ->sk_rmem_alloc
> before moving the skb to other->sk_receive_queue. I believe
> he is right. So, just call skb_set_owner_r() before every time
> we queuing skb into other->sk_receive_queue.
>
> 1. http://marc.info/?l=linux-netdev&m=135882012924930&w=2
>
> Reported-by: Yannick Koehler <yannick@...hler.name>
> Cc: Yannick Koehler <yannick@...hler.name>
> Cc: Eric Dumazet <eric.dumazet@...il.com>
> Cc: David S. Miller <davem@...emloft.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
>
> ---
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 5b5c876..7e9dba3 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -1205,6 +1205,7 @@ restart:
>
> unix_state_unlock(sk);
>
> + skb_set_owner_r(skb, other);
> /* take ten and and send info to listening sock */
> spin_lock(&other->sk_receive_queue.lock);
> __skb_queue_tail(&other->sk_receive_queue, skb);
> @@ -1579,6 +1580,7 @@ restart:
> if (sock_flag(other, SOCK_RCVTSTAMP))
> __net_timestamp(skb);
> maybe_add_creds(skb, sock, other);
> + skb_set_owner_r(skb, other);
> skb_queue_tail(&other->sk_receive_queue, skb);
> if (max_level > unix_sk(other)->recursion_level)
> unix_sk(other)->recursion_level = max_level;
> @@ -1694,6 +1696,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock,
> goto pipe_err_free;
>
> maybe_add_creds(skb, sock, other);
> + skb_set_owner_r(skb, other);
> skb_queue_tail(&other->sk_receive_queue, skb);
> if (max_level > unix_sk(other)->recursion_level)
> unix_sk(other)->recursion_level = max_level;
I Nack this patch, for reasons already given.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists