[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20090716.180955.105341181.davem@davemloft.net>
Date: Thu, 16 Jul 2009 18:09:55 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: eric.dumazet@...il.com
Cc: kaber@...sh.net, netdev@...r.kernel.org, paulmck@...ux.vnet.ibm.com
Subject: Re: [PATCH] net: sock_copy() fixes
From: Eric Dumazet <eric.dumazet@...il.com>
Date: Thu, 16 Jul 2009 11:13:10 +0200
> [PATCH] net: sock_copy() fixes
>
> Commit e912b1142be8f1e2c71c71001dc992c6e5eb2ec1
> (net: sk_prot_alloc() should not blindly overwrite memory)
> took care of not zeroing whole new socket at allocation time.
>
> sock_copy() is another spot where we should be very careful.
> We should not set refcnt to a non null value, until
> we are sure other fields are correctly setup, or
> a lockless reader could catch this socket by mistake,
> while not fully (re)initialized.
>
> This patch puts sk_node & sk_refcnt to the very beginning
> of struct sock to ease sock_copy() & sk_prot_alloc() job.
>
> We add appropriate smp_wmb() before sk_refcnt initializations
> to match our RCU requirements (changes to sock keys should
> be committed to memory before sk_refcnt setting)
>
> Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
Applied and queued for -stable, thanks!
--
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