public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	davem@davemloft.net
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk,
	chas@cmf.nrl.navy.mil, netdev@vger.kernel.org,
	Stephen Hemminger <shemminger@osdl.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [patch 22/22] atm: clip causes unregister hang
Date: Thu, 13 Apr 2006 16:09:46 -0700	[thread overview]
Message-ID: <20060413230946.GW5613@kroah.com> (raw)
In-Reply-To: <20060413230637.GA5613@kroah.com>

[-- Attachment #1: atm-clip-causes-unregister-hang.patch --]
[-- Type: text/plain, Size: 3445 bytes --]

-stable review patch.  If anyone has any objections, please let us know.

------------------

If Classical IP over ATM module is loaded, its neighbor table gets
populated when permanent neighbor entries are created; but these entries
are not flushed when the device is removed. Since the entry never gets
flushed the unregister of the network device never completes.

This version of the patch also adds locking around the reference to
the atm arp daemon to avoid races with events and daemon state changes.
(Note: barrier() was never really safe)

Bug-reference: http://bugzilla.kernel.org/show_bug.cgi?id=6295

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 net/atm/clip.c |   42 +++++++++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 15 deletions(-)

--- linux-2.6.16.5.orig/net/atm/clip.c
+++ linux-2.6.16.5/net/atm/clip.c
@@ -613,12 +613,19 @@ static int clip_create(int number)
 
 
 static int clip_device_event(struct notifier_block *this,unsigned long event,
-    void *dev)
+			     void *arg)
 {
+	struct net_device *dev = arg;
+
+	if (event == NETDEV_UNREGISTER) {
+		neigh_ifdown(&clip_tbl, dev);
+		return NOTIFY_DONE;
+	}
+
 	/* ignore non-CLIP devices */
-	if (((struct net_device *) dev)->type != ARPHRD_ATM ||
-	    ((struct net_device *) dev)->hard_start_xmit != clip_start_xmit)
+	if (dev->type != ARPHRD_ATM || dev->hard_start_xmit != clip_start_xmit)
 		return NOTIFY_DONE;
+
 	switch (event) {
 		case NETDEV_UP:
 			DPRINTK("clip_device_event NETDEV_UP\n");
@@ -686,14 +693,12 @@ static struct notifier_block clip_inet_n
 static void atmarpd_close(struct atm_vcc *vcc)
 {
 	DPRINTK("atmarpd_close\n");
-	atmarpd = NULL; /* assumed to be atomic */
-	barrier();
-	unregister_inetaddr_notifier(&clip_inet_notifier);
-	unregister_netdevice_notifier(&clip_dev_notifier);
-	if (skb_peek(&sk_atm(vcc)->sk_receive_queue))
-		printk(KERN_ERR "atmarpd_close: closing with requests "
-		    "pending\n");
+
+	rtnl_lock();
+	atmarpd = NULL;
 	skb_queue_purge(&sk_atm(vcc)->sk_receive_queue);
+	rtnl_unlock();
+
 	DPRINTK("(done)\n");
 	module_put(THIS_MODULE);
 }
@@ -714,7 +719,12 @@ static struct atm_dev atmarpd_dev = {
 
 static int atm_init_atmarp(struct atm_vcc *vcc)
 {
-	if (atmarpd) return -EADDRINUSE;
+	rtnl_lock();
+	if (atmarpd) {
+		rtnl_unlock();
+		return -EADDRINUSE;
+	}
+
 	if (start_timer) {
 		start_timer = 0;
 		init_timer(&idle_timer);
@@ -731,10 +741,7 @@ static int atm_init_atmarp(struct atm_vc
 	vcc->push = NULL;
 	vcc->pop = NULL; /* crash */
 	vcc->push_oam = NULL; /* crash */
-	if (register_netdevice_notifier(&clip_dev_notifier))
-		printk(KERN_ERR "register_netdevice_notifier failed\n");
-	if (register_inetaddr_notifier(&clip_inet_notifier))
-		printk(KERN_ERR "register_inetaddr_notifier failed\n");
+	rtnl_unlock();
 	return 0;
 }
 
@@ -992,6 +999,8 @@ static int __init atm_clip_init(void)
 
 	clip_tbl_hook = &clip_tbl;
 	register_atm_ioctl(&clip_ioctl_ops);
+	register_netdevice_notifier(&clip_dev_notifier);
+	register_inetaddr_notifier(&clip_inet_notifier);
 
 #ifdef CONFIG_PROC_FS
 {
@@ -1012,6 +1021,9 @@ static void __exit atm_clip_exit(void)
 
 	remove_proc_entry("arp", atm_proc_root);
 
+	unregister_inetaddr_notifier(&clip_inet_notifier);
+	unregister_netdevice_notifier(&clip_dev_notifier);
+
 	deregister_atm_ioctl(&clip_ioctl_ops);
 
 	/* First, stop the idle timer, so it stops banging

--

      parent reply	other threads:[~2006-04-13 23:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20060413230141.330705000@quad.kroah.org>
2006-04-13 23:06 ` [patch 00/22] -stable review Greg KH
2006-04-13 23:06   ` [patch 01/22] powerpc: iSeries needs slb_initialize to be called Greg KH
2006-04-13 23:06   ` [patch 02/22] powerpc: fix incorrect SA_ONSTACK behaviour for 64-bit processes Greg KH
2006-04-24  8:27     ` Laurent MEYER
2006-04-13 23:07   ` [patch 03/22] MPBL0010 driver sysfs permissions wide open Greg KH
2006-04-13 23:07   ` [patch 04/22] isd200: limit to BLK_DEV_IDE Greg KH
2006-04-14  1:58     ` Jeff Garzik
2006-04-15 11:51       ` Adrian Bunk
2006-04-13 23:07   ` [patch 05/22] sky2: bad memory reference on dual port cards Greg KH
2006-04-13 23:07   ` [patch 06/22] NETFILTER: Fix fragmentation issues with bridge netfilter Greg KH
2006-04-13 23:07   ` [patch 07/22] m32r: security fix of {get, put}_user macros Greg KH
2006-04-13 23:07   ` [patch 08/22] m32r: Fix cpu_possible_map and cpu_present_map initialization for SMP kernel Greg KH
2006-04-13 23:07   ` [patch 09/22] fuse: fix oops in fuse_send_readpages() Greg KH
2006-04-13 23:07   ` [patch 10/22] Fix buddy list race that could lead to page lru list corruptions Greg KH
2006-04-13 23:08   ` [patch 11/22] Fix block device symlink name Greg KH
2006-04-14  0:57     ` Christoph Hellwig
2006-04-14 19:48       ` [stable] " Greg KH
2006-04-13 23:08   ` [patch 12/22] ext3: Fix missed mutex unlock Greg KH
2006-04-13 23:08   ` [patch 13/22] edac_752x needs CONFIG_HOTPLUG Greg KH
2006-04-13 23:25     ` Dave Peterson
2006-04-13 23:44       ` Greg KH
2006-04-13 23:08   ` [patch 14/22] cciss: bug fix for crash when running hpacucli Greg KH
2006-04-13 23:08   ` [patch 15/22] alpha: SMP boot fixes Greg KH
2006-04-13 23:09   ` [patch 16/22] Fix utime(2) in the case that no times parameter was passed in Greg KH
2006-04-13 23:09   ` [patch 17/22] RLIMIT_CPU: fix handling of a zero limit Greg KH
2006-04-13 23:09   ` [patch 18/22] Incorrect signature sent on SMB Read Greg KH
2006-04-13 23:09   ` [patch 19/22] Fix suspend with traced tasks Greg KH
2006-04-13 23:09   ` [patch 20/22] USB: remove __init from usb_console_setup Greg KH
2006-04-13 23:09   ` [patch 21/22] fix non-leader exec under ptrace Greg KH
2006-04-14 18:52     ` Andrea Arcangeli
2006-04-13 23:09   ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060413230946.GW5613@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=chas@cmf.nrl.navy.mil \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rdunlap@xenotime.net \
    --cc=shemminger@osdl.org \
    --cc=stable@kernel.org \
    --cc=torvalds@osdl.org \
    --cc=tytso@mit.edu \
    --cc=zwane@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox