]> git.baikalelectronics.ru Git - kernel.git/commit
netlink: fix netlink_change_ngroups()
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 24 Oct 2010 04:27:10 +0000 (04:27 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 24 Oct 2010 23:25:39 +0000 (16:25 -0700)
commit7d422e58231976bd127b5812b1d7cc3c88bf02d1
treef4305312340df1ebeae5de3896d3fb4c3da3c6e8
parent5ce6e10fb2295ba08c814145108411c55f6de2c4
netlink: fix netlink_change_ngroups()

commit 9df5b0f5889aaa (netlink: use call_rcu for netlink_change_ngroups)
used a somewhat convoluted and racy way to perform call_rcu().

The old block of memory is freed after a grace period, but the rcu_head
used to track it is located in new block.

This can clash if we call two times or more netlink_change_ngroups(),
and a block is freed before another. call_rcu() called on different cpus
makes no guarantee in order of callbacks.

Fix this using a more standard way of handling this : Each block of
memory contains its own rcu_head, so that no 'use after free' can
happens.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Johannes Berg <johannes@sipsolutions.net>
CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c