]> git.baikalelectronics.ru Git - kernel.git/commit
net: fix dev_seq_next()
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 26 Jan 2011 18:08:02 +0000 (18:08 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 27 Jan 2011 23:02:56 +0000 (15:02 -0800)
commit9bc4184d3af224cabca449b2b50d5ceade8a2b2e
tree1e1a36691f42ed7448f27f71a9ca9445e88ab5f1
parentb8ae65fcc4e7530481fc92e25da17bae43f7348b
net: fix dev_seq_next()

Commit 86f1fd652473 (net: Introduce for_each_netdev_rcu() iterator)
added a race in dev_seq_next().

The rcu_dereference() call should be done _before_ testing the end of
list, or we might return a wrong net_device if a concurrent thread
changes net_device list under us.

Note : discovered thanks to a sparse warning :

net/core/dev.c:3919:9: error: incompatible types in comparison expression
(different address spaces)

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netdevice.h
net/core/dev.c