Skip to content

Commit

Permalink
br2684: fix scheduling while atomic
Browse files Browse the repository at this point in the history
You can't call atomic_notifier_chain_unregister() while in atomic context.

Fix, call un/register_atmdevice_notifier in module __init and __exit.

Bug report:
http://comments.gmane.org/gmane.linux.network/172603

Reported-by: Mikko Vinni <[email protected]>
Tested-by: Mikko Vinni <[email protected]>
Signed-off-by: Karl Hiramoto <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
karlhiramoto authored and davem330 committed Sep 27, 2010
1 parent ca9a783 commit a3d6713
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions net/atm/br2684.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,6 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
unregister_netdev(net_dev);
free_netdev(net_dev);
}
read_lock_irq(&devs_lock);
if (list_empty(&br2684_devs)) {
/* last br2684 device */
unregister_atmdevice_notifier(&atm_dev_notifier);
}
read_unlock_irq(&devs_lock);
return;
}

Expand Down Expand Up @@ -675,7 +669,6 @@ static int br2684_create(void __user *arg)

if (list_empty(&br2684_devs)) {
/* 1st br2684 device */
register_atmdevice_notifier(&atm_dev_notifier);
brdev->number = 1;
} else
brdev->number = BRPRIV(list_entry_brdev(br2684_devs.prev))->number + 1;
Expand Down Expand Up @@ -815,6 +808,7 @@ static int __init br2684_init(void)
return -ENOMEM;
#endif
register_atm_ioctl(&br2684_ioctl_ops);
register_atmdevice_notifier(&atm_dev_notifier);
return 0;
}

Expand All @@ -830,9 +824,7 @@ static void __exit br2684_exit(void)
#endif


/* if not already empty */
if (!list_empty(&br2684_devs))
unregister_atmdevice_notifier(&atm_dev_notifier);
unregister_atmdevice_notifier(&atm_dev_notifier);

while (!list_empty(&br2684_devs)) {
net_dev = list_entry_brdev(br2684_devs.next);
Expand Down

0 comments on commit a3d6713

Please sign in to comment.