linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@osdl.org>
To: Patrick Mochel <mochel@osdl.org>
Cc: "David S. Miller" <davem@redhat.com>,
	Martin Josefsson <gandalf@wlug.westbo.se>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] sysfs -- don't crash if removing non-existant attribute group
Date: Mon, 13 Oct 2003 16:25:59 -0700	[thread overview]
Message-ID: <20031013162559.5ff55929.shemminger@osdl.org> (raw)
In-Reply-To: <20031003224931.57ac536a.davem@redhat.com>

Some (buggy) network drivers in 2.6 decide to set the statistics hook,
after registration. This causes unregister_netdevice to crash because it attempts 
to remove the 'statistics' attribute group it thought was created.  

This fixes sysfs so it ignores the problem.  Another set of patches
will address the remaining buggy ether drivers.

diff -Nru a/fs/sysfs/group.c b/fs/sysfs/group.c
--- a/fs/sysfs/group.c	Mon Oct 13 16:04:31 2003
+++ b/fs/sysfs/group.c	Mon Oct 13 16:04:31 2003
@@ -65,9 +65,11 @@
 {
 	struct dentry * dir;
 
-	if (grp->name)
+	if (grp->name) {
 		dir = sysfs_get_dentry(kobj->dentry,grp->name);
-	else
+		if (dir == NULL)	/* non-existent */
+			return;
+	} else
 		dir = kobj->dentry;
 
 	remove_files(dir,grp);

       reply	other threads:[~2003-10-13 23:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20031003224931.57ac536a.davem@redhat.com>
2003-10-13 23:25 ` Stephen Hemminger [this message]
2003-10-14 17:38   ` [PATCH] sysfs -- don't crash if removing non-existant attribute group David S. Miller

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=20031013162559.5ff55929.shemminger@osdl.org \
    --to=shemminger@osdl.org \
    --cc=davem@redhat.com \
    --cc=gandalf@wlug.westbo.se \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    /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;
as well as URLs for NNTP newsgroup(s).