All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Chris Rankin <rankincj@yahoo.com>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-usb-devel@lists.sourceforge.net,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Greg K-H <greg@kroah.com>,
	maneesh@in.ibm.com,
	"cornelia.huck@de.ibm.com >> Cornelia Huck" 
	<cornelia.huck@de.ibm.com>
Subject: Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
Date: Wed, 09 May 2007 16:58:55 +0200	[thread overview]
Message-ID: <4641E1AF.9060201@gmail.com> (raw)
In-Reply-To: <d120d5000705090735o65591855yea6649d725fabb13@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

Dmitry Torokhov wrote:
>> As written above, I think it's better to risk module unload / sysfs race
>> than keeping the current sysfs deletion / open race.  What do you guys
>> think?
>>
> 
> How about embedding struct attribute fro devt into struct
> [class_]device for now? It is not too big and device is still going to
> be pinned into memory while there are sysfs users... I don't like
> fattening of device structures but leaks and/or oopses are worse in my
> book.

Right, your book is apparently much better than mine.  Actually, we can
just free devt_attr in device_release().  Looking at the code, class
device is already doing it that way, so here's the full-assed fix.
Chris, can you please test the attached patch?

Thanks.

-- 
tejun

[-- Attachment #2: fix-devt_attr-release --]
[-- Type: text/plain, Size: 857 bytes --]

---
 drivers/base/core.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: tree0/drivers/base/core.c
===================================================================
--- tree0.orig/drivers/base/core.c
+++ tree0/drivers/base/core.c
@@ -93,6 +93,9 @@ static void device_release(struct kobjec
 {
 	struct device * dev = to_dev(kobj);
 
+	kfree(dev->devt_attr);
+	dev->devt_attr = NULL;
+
 	if (dev->release)
 		dev->release(dev);
 	else if (dev->class && dev->class->dev_release)
@@ -650,10 +653,8 @@ void device_del(struct device * dev)
 
 	if (parent)
 		klist_del(&dev->knode_parent);
-	if (dev->devt_attr) {
+	if (dev->devt_attr)
 		device_remove_file(dev, dev->devt_attr);
-		kfree(dev->devt_attr);
-	}
 	if (dev->class) {
 		sysfs_remove_link(&dev->kobj, "subsystem");
 		/* If this is not a "fake" compatible device, remove the

  reply	other threads:[~2007-05-09 14:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <963898.10047.qm@web52906.mail.re2.yahoo.com>
2007-05-09  9:40 ` [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198) Tejun Heo
2007-05-09 12:24   ` Chris Rankin
2007-05-09 13:30     ` Tejun Heo
2007-05-09 13:56       ` Chris Rankin
2007-05-09 14:11         ` Tejun Heo
2007-05-09 14:35           ` Dmitry Torokhov
2007-05-09 14:58             ` Tejun Heo [this message]
2007-05-09 21:09               ` Chris Rankin
2007-05-09 14:57       ` Greg KH
2007-05-09 15:01         ` Tejun Heo
2007-05-09 15:40           ` Greg KH
2007-05-10 14:45             ` [PATCH] driver-core: don't free devt_attr till the device is released Tejun Heo
2007-05-10 15:05               ` Greg KH
2007-05-10 15:13                 ` Tejun Heo
2007-05-10 15:17                   ` Greg KH
2007-05-10 15:33               ` Kay Sievers
2007-05-10 15:41                 ` Tejun Heo
2007-05-10 15:52               ` Alan Stern
2007-05-10 16:18                 ` Tejun Heo
2007-05-10 14:25         ` [PATCH 2.6.21-mm2] driver-core: make devt_attr and uevent_attr static Tejun Heo

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=4641E1AF.9060201@gmail.com \
    --to=htejun@gmail.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=maneesh@in.ibm.com \
    --cc=rankincj@yahoo.com \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.