linux/net
Eric Dumazet 941297f443 netfilter: nf_conntrack: nf_conntrack_alloc() fixes
When a slab cache uses SLAB_DESTROY_BY_RCU, we must be careful when allocating
objects, since slab allocator could give a freed object still used by lockless
readers.

In particular, nf_conntrack RCU lookups rely on ct->tuplehash[xxx].hnnode.next
being always valid (ie containing a valid 'nulls' value, or a valid pointer to next
object in hash chain.)

kmem_cache_zalloc() setups object with NULL values, but a NULL value is not valid
for ct->tuplehash[xxx].hnnode.next.

Fix is to call kmem_cache_alloc() and do the zeroing ourself.

As spotted by Patrick, we also need to make sure lookup keys are committed to
memory before setting refcount to 1, or a lockless reader could get a reference
on the old version of the object. Its key re-check could then pass the barrier.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
2009-07-16 14:03:40 +02:00
..
9p
802
8021q
appletalk net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
atm atm: sk_wmem_alloc initial value is one 2009-06-18 00:29:12 -07:00
ax25 net: Move rx skb_orphan call to where needed 2009-06-23 16:36:25 -07:00
bluetooth net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
bridge
can
core Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-06-24 10:01:12 -07:00
dcb
dccp ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
decnet net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
dsa
econet net: sk_wmem_alloc has initial value of one, not zero 2009-06-17 04:31:25 -07:00
ethernet
ieee802154 ieee802154: use standard routine for printing dumps 2009-06-19 00:18:43 -07:00
ipv4 netfilter: tcp conntrack: fix unacknowledged data detection with NAT 2009-06-29 14:07:56 +02:00
ipv6 ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
ipx net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
irda net: Move rx skb_orphan call to where needed 2009-06-23 16:36:25 -07:00
iucv Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-06-22 11:57:09 -07:00
key net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
lapb
llc net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
mac80211 mac80211: fix wext bssid/ssid setting 2009-06-15 15:05:59 -04:00
netfilter netfilter: nf_conntrack: nf_conntrack_alloc() fixes 2009-07-16 14:03:40 +02:00
netlabel
netlink net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
netrom net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
packet net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
phonet
rds
rfkill rfkill: export persistent attribute in sysfs 2009-06-19 11:50:18 -04:00
rose net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
rxrpc RxRPC: Don't attempt to reuse aborted connections 2009-06-16 21:20:14 -07:00
sched net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
sctp ipv6: Use correct data types for ICMPv6 type and code 2009-06-23 04:31:07 -07:00
sunrpc Merge branch 'for-2.6.31' of git://fieldses.org/git/linux-nfsd 2009-06-22 12:55:50 -07:00
tipc
unix net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
wanrouter
wimax
wireless cfg80211: validate station settings 2009-06-19 11:50:24 -04:00
x25 net: correct off-by-one write allocations reports 2009-06-18 00:29:12 -07:00
xfrm
compat.c
Kconfig
Makefile
nonet.c
socket.c
sysctl_net.c
TUNABLE