Skip to content

Commit

Permalink
[VLAN]: Fix potential race in vlan_cleanup_module vs vlan_ioctl_handler.
Browse files Browse the repository at this point in the history
The vlan module cleanup function starts with

	vlan_netlink_fini();
	vlan_ioctl_set(NULL);

The first call removes all the vlan devices and
the second one closes the vlan ioctl.

AFAIS there's a tiny race window between these two
calls - after rtnl unregistered all the vlans, but
the ioctl handler isn't set to NULL yet, user can
manage to call this ioctl and create one vlan device,
and that this function will later BUG_ON seeing
non-emply hashes.

I think, that we must first close the vlan ioctl
and only after this remove all the vlans with the
vlan_netlink_fini() call.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Dec 11, 2007
1 parent d59b54b commit 3f03e38
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/8021q/vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ static void __exit vlan_cleanup_module(void)
{
int i;

vlan_netlink_fini();
vlan_ioctl_set(NULL);
vlan_netlink_fini();

/* Un-register us from receiving netdevice events */
unregister_netdevice_notifier(&vlan_notifier_block);
Expand Down

0 comments on commit 3f03e38

Please sign in to comment.