Patchwork br2684: fix scheduling while atomic

login
register
mail settings
Submitter Karl Hiramoto
Date Sept. 23, 2010, 11:50 a.m.
Message ID <1285242654-9891-1-git-send-email-karl@hiramoto.org>
Download mbox | patch
Permalink /patch/65529/
State Accepted
Delegated to: David Miller
Headers show

Comments

Karl Hiramoto - Sept. 23, 2010, 11:50 a.m.
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

Signed-off-by: Karl Hiramoto <karl@hiramoto.org>
---
 net/atm/br2684.c |   12 ++----------
 1 files changed, 2 insertions(+), 10 deletions(-)
Mikko Vinni - Sept. 23, 2010, 4:51 p.m.
From: Karl Hiramoto <karl@hiramoto.org>
> Subject: [PATCH] br2684: fix scheduling while atomic
> 
> 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
> 
> Signed-off-by:  Karl Hiramoto <karl@hiramoto.org>

Feel free to add

Reported-and-tested-by: Mikko Vinni <mmvinni@yahoo.com>

Seems to be fixed as advertized, i.e., nothing suspicious appeared in
the logs when opening/closing connection, killing br2684ctl, or
loading/unloading the br2684 module.


Thanks

Mikko


> ---
>   net/atm/br2684.c |   12 ++----------
>  1 files changed, 2 insertions(+),  10 deletions(-)
> 
> diff --git a/net/atm/br2684.c b/net/atm/br2684.c
> index  651babd..ad2b232 100644


      
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Sept. 27, 2010, 1:29 a.m.
From: Mikko Vinni <mmvinni@yahoo.com>
Date: Thu, 23 Sep 2010 09:51:24 -0700 (PDT)

> From: Karl Hiramoto <karl@hiramoto.org>
>> Subject: [PATCH] br2684: fix scheduling while atomic
>> 
>> 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
>> 
>> Signed-off-by:  Karl Hiramoto <karl@hiramoto.org>
> 
> Feel free to add
> 
> Reported-and-tested-by: Mikko Vinni <mmvinni@yahoo.com>

Applied, thanks guys.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/atm/br2684.c b/net/atm/br2684.c
index 651babd..ad2b232 100644
--- a/net/atm/br2684.c
+++ b/net/atm/br2684.c
@@ -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;
 	}
 
@@ -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;
@@ -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;
 }
 
@@ -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);