]> git.baikalelectronics.ru Git - kernel.git/commit
net: remove type_check from dev_get_nest_level()
authorSabrina Dubroca <sd@queasysnail.net>
Fri, 12 Aug 2016 14:10:33 +0000 (16:10 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Aug 2016 22:15:54 +0000 (15:15 -0700)
commit6ba9e2f4ac1dbc88324d091463ebb6d1a80c19fe
tree16e787138d3da28899e3a0028962928c79a4af07
parent23ceab8037cb3f3124f2c7e9b5d204a852fada2b
net: remove type_check from dev_get_nest_level()

The idea for type_check in dev_get_nest_level() was to count the number
of nested devices of the same type (currently, only macvlan or vlan
devices).
This prevented the false positive lockdep warning on configurations such
as:

eth0 <--- macvlan0 <--- vlan0 <--- macvlan1

However, this doesn't prevent a warning on a configuration such as:

eth0 <--- macvlan0 <--- vlan0
eth1 <--- vlan1 <--- macvlan1

In this case, all the locks end up with a nesting subclass of 1, so
lockdep thinks that there is still a deadlock:

- in the first case we have (macvlan_netdev_addr_lock_key, 1) and then
  take (vlan_netdev_xmit_lock_key, 1)
- in the second case, we have (vlan_netdev_xmit_lock_key, 1) and then
  take (macvlan_netdev_addr_lock_key, 1)

By removing the linktype check in dev_get_nest_level() and always
incrementing the nesting depth, lockdep considers this configuration
valid.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macsec.c
drivers/net/macvlan.c
include/linux/netdevice.h
net/8021q/vlan.c
net/core/dev.c