Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- From: Tejun Heo <htejun@xxxxxxxxx>
- Date: Wed, 09 May 2007 16:58:55 +0200
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
---
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
- Follow-Ups:
- References:
- Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- From: Chris Rankin
- Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- From: Tejun Heo
- Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- From: Dmitry Torokhov
- Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- Prev by Date: Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- Next by Date: [Linux-fbdev-devel] [PATCH] atmel_lcdfb: AT91/AT32 LCD Controller framebuffer driver
- Previous by thread: Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- Next by thread: Re: [linux-usb-devel] Bug creating USB endpoints in 2.6.20.x (kernel bug 8198)
- Index(es):