Eric Dumazet 4dc6dc7162 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@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2009-07-16 18:05:26 -07:00
..
2008-09-12 16:30:20 -07:00
2009-06-03 14:06:14 -04:00
2009-03-21 19:06:54 -07:00
2009-06-03 02:51:04 -07:00
2008-11-25 17:35:18 -08:00
2008-07-05 21:26:57 -07:00
2009-06-03 02:51:04 -07:00
2009-06-03 02:51:04 -07:00
2008-06-11 21:00:38 -07:00
2009-06-03 02:51:04 -07:00
2008-06-11 21:00:38 -07:00
2009-04-27 02:45:02 -07:00
2008-06-11 21:00:38 -07:00
2009-05-19 16:02:02 -07:00
2009-04-27 02:45:02 -07:00
2008-02-29 11:46:17 -08:00
2008-03-28 16:28:36 -07:00
2008-11-12 00:54:54 -08:00
2009-03-03 01:14:27 -08:00
2009-01-06 11:38:15 -07:00
2008-11-16 23:01:49 -08:00
2009-03-21 19:06:50 -07:00
2009-04-22 16:57:17 -04:00
2009-06-03 02:51:02 -07:00
2008-11-14 11:29:12 +11:00
2009-04-27 02:45:02 -07:00
2009-07-16 18:05:26 -07:00
2008-07-05 21:25:39 -07:00
2009-06-03 14:06:13 -04:00