* [PATCH] X.25: decrement netdev reference counts on unload
@ 2010-12-07 19:43 Apollon Oikonomopoulos
2010-12-07 22:48 ` Andrew Hendry
2010-12-08 18:55 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Apollon Oikonomopoulos @ 2010-12-07 19:43 UTC (permalink / raw)
To: netdev
Hello,
We came across this bug when we accidentally loaded and unloaded the x25
kernel module on a host with KVM virtual machines. All subsequent
attempts to stop a KVM instance resulted in the KVM process entering D
state. Reproducing this behaviour can be done in the following way:
1. modprobe x25
2. tunctl && ifconfig tap0 up
3. rmmod x25
4. tunctl -d tap0 (hangs)
A patch follows - we don't use X.25 ourselves so I'm not sure it won't
panic someone's system.
Regards,
Apollon
PS: I am not subscribed to the list, so please copy any replies to my
address. Thanks!
----
x25 does not decrement the network device reference counts on module unload.
Thus unregistering any pre-existing interface after unloading the x25 module
hangs and results in
unregister_netdevice: waiting for tap0 to become free. Usage count = 1
This patch decrements the reference counts of all interfaces in x25_link_free,
the way it is already done in x25_link_device_down for NETDEV_DOWN events.
Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
---
net/x25/x25_link.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c
index 73e7b95..b25c646 100644
--- a/net/x25/x25_link.c
+++ b/net/x25/x25_link.c
@@ -394,6 +394,7 @@ void __exit x25_link_free(void)
list_for_each_safe(entry, tmp, &x25_neigh_list) {
nb = list_entry(entry, struct x25_neigh, node);
__x25_remove_neigh(nb);
+ dev_put(nb->dev);
}
write_unlock_bh(&x25_neigh_list_lock);
}
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] X.25: decrement netdev reference counts on unload
2010-12-07 19:43 [PATCH] X.25: decrement netdev reference counts on unload Apollon Oikonomopoulos
@ 2010-12-07 22:48 ` Andrew Hendry
2010-12-08 18:55 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Hendry @ 2010-12-07 22:48 UTC (permalink / raw)
To: Apollon Oikonomopoulos; +Cc: netdev
Thanks for the patch.
Can reproduce it on a vm here, I'll verify it when have access to some
X.25 networks tomorrow.
2010/12/8 Apollon Oikonomopoulos <apollon@noc.grnet.gr>:
> Hello,
>
> We came across this bug when we accidentally loaded and unloaded the x25
> kernel module on a host with KVM virtual machines. All subsequent
> attempts to stop a KVM instance resulted in the KVM process entering D
> state. Reproducing this behaviour can be done in the following way:
>
> 1. modprobe x25
> 2. tunctl && ifconfig tap0 up
> 3. rmmod x25
> 4. tunctl -d tap0 (hangs)
>
> A patch follows - we don't use X.25 ourselves so I'm not sure it won't
> panic someone's system.
>
> Regards,
> Apollon
>
> PS: I am not subscribed to the list, so please copy any replies to my
> address. Thanks!
> ----
> x25 does not decrement the network device reference counts on module unload.
> Thus unregistering any pre-existing interface after unloading the x25 module
> hangs and results in
>
> unregister_netdevice: waiting for tap0 to become free. Usage count = 1
>
> This patch decrements the reference counts of all interfaces in x25_link_free,
> the way it is already done in x25_link_device_down for NETDEV_DOWN events.
>
> Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
> ---
> net/x25/x25_link.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/net/x25/x25_link.c b/net/x25/x25_link.c
> index 73e7b95..b25c646 100644
> --- a/net/x25/x25_link.c
> +++ b/net/x25/x25_link.c
> @@ -394,6 +394,7 @@ void __exit x25_link_free(void)
> list_for_each_safe(entry, tmp, &x25_neigh_list) {
> nb = list_entry(entry, struct x25_neigh, node);
> __x25_remove_neigh(nb);
> + dev_put(nb->dev);
> }
> write_unlock_bh(&x25_neigh_list_lock);
> }
> --
> 1.7.1
> --
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] X.25: decrement netdev reference counts on unload
2010-12-07 19:43 [PATCH] X.25: decrement netdev reference counts on unload Apollon Oikonomopoulos
2010-12-07 22:48 ` Andrew Hendry
@ 2010-12-08 18:55 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-12-08 18:55 UTC (permalink / raw)
To: apollon; +Cc: netdev
From: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Date: Tue, 7 Dec 2010 21:43:30 +0200
> x25 does not decrement the network device reference counts on module unload.
> Thus unregistering any pre-existing interface after unloading the x25 module
> hangs and results in
>
> unregister_netdevice: waiting for tap0 to become free. Usage count = 1
>
> This patch decrements the reference counts of all interfaces in x25_link_free,
> the way it is already done in x25_link_device_down for NETDEV_DOWN events.
>
> Signed-off-by: Apollon Oikonomopoulos <apollon@noc.grnet.gr>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-08 18:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 19:43 [PATCH] X.25: decrement netdev reference counts on unload Apollon Oikonomopoulos
2010-12-07 22:48 ` Andrew Hendry
2010-12-08 18:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).