From: Jiri Pirko Date: Thu, 9 May 2013 04:23:40 +0000 (+0000) Subject: macvlan: fix passthru mode race between dev removal and rx path X-Git-Tag: v3.10-rc2~34^2~14 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=233c7df0821c4190e2d3f4be0f2ca0ab40a5ed8c;p=pandora-kernel.git macvlan: fix passthru mode race between dev removal and rx path Currently, if macvlan in passthru mode is created and data are rxed and you remove this device, following panic happens: NULL pointer dereference at 0000000000000198 IP: [] macvlan_handle_frame+0x153/0x1f7 [macvlan] I'm using following script to trigger this: I run this script while "ping -f" is running on another machine to send packets to e1 rx. Reason of the panic is that list_first_entry() is blindly called in macvlan_handle_frame() even if the list was empty. vlan is set to incorrect pointer which leads to the crash. I'm fixing this by protecting port->vlans list by rcu and by preventing from getting incorrect pointer in case the list is empty. Introduced by: commit eb06acdc85585f2 "macvlan: Introduce 'passthru' mode to takeover the underlying device" Signed-off-by: Jiri Pirko Acked-by: Eric Dumazet Signed-off-by: David S. Miller --- Reading git-diff-tree failed