* BUG in driver model class.c
@ 2003-06-11 17:12 Alan Stern
2003-06-11 17:18 ` Greg KH
2003-06-11 21:51 ` Greg KH
0 siblings, 2 replies; 4+ messages in thread
From: Alan Stern @ 2003-06-11 17:12 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel
Greg:
There is a bug in drivers/base/class.c in 2.5.70. Near the start of the
routine class_device_add() are the lines
if (class_dev->dev)
get_device(class_dev->dev);
But there's nothing to undo this get_device, either in the error return
part of class_device_add() or in class_device_del().
I assume that either this get_device() doesn't belong there or else there
should be corresponding put_device() calls in the other two spots.
Whichever is the case, it should be easy for you to fix.
Alan Stern
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BUG in driver model class.c
2003-06-11 17:12 BUG in driver model class.c Alan Stern
@ 2003-06-11 17:18 ` Greg KH
2003-06-11 21:51 ` Greg KH
1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2003-06-11 17:18 UTC (permalink / raw)
To: Alan Stern; +Cc: linux-kernel
On Wed, Jun 11, 2003 at 01:12:47PM -0400, Alan Stern wrote:
> Greg:
>
> There is a bug in drivers/base/class.c in 2.5.70. Near the start of the
> routine class_device_add() are the lines
>
> if (class_dev->dev)
> get_device(class_dev->dev);
>
> But there's nothing to undo this get_device, either in the error return
> part of class_device_add() or in class_device_del().
>
> I assume that either this get_device() doesn't belong there or else there
> should be corresponding put_device() calls in the other two spots.
> Whichever is the case, it should be easy for you to fix.
Already fixed in Linus's -bk tree :)
thanks for pointing it out though.
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BUG in driver model class.c
2003-06-11 17:12 BUG in driver model class.c Alan Stern
2003-06-11 17:18 ` Greg KH
@ 2003-06-11 21:51 ` Greg KH
2003-06-11 21:54 ` Patrick Mochel
1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2003-06-11 21:51 UTC (permalink / raw)
To: Alan Stern, Patrick Mochel; +Cc: linux-kernel
On Wed, Jun 11, 2003 at 01:12:47PM -0400, Alan Stern wrote:
> Greg:
>
> There is a bug in drivers/base/class.c in 2.5.70. Near the start of the
> routine class_device_add() are the lines
>
> if (class_dev->dev)
> get_device(class_dev->dev);
>
> But there's nothing to undo this get_device, either in the error return
> part of class_device_add() or in class_device_del().
>
> I assume that either this get_device() doesn't belong there or else there
> should be corresponding put_device() calls in the other two spots.
> Whichever is the case, it should be easy for you to fix.
You are correct. I took out the other put_device() in the -bk tree in
class_device_del() but forgot to remove this one. Good catch.
Pat, here's a patch to fix this up, against the latest -bk tree.
thanks,
greg k-h
# Driver core: fix unbounded get_device() in class_device_add()
#
# This was found by Alan Stern.
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c Wed Jun 11 14:47:20 2003
+++ b/drivers/base/class.c Wed Jun 11 14:47:20 2003
@@ -264,8 +264,6 @@
return -EINVAL;
parent = class_get(class_dev->class);
- if (class_dev->dev)
- get_device(class_dev->dev);
pr_debug("CLASS: registering class device: ID = '%s'\n",
class_dev->class_id);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: BUG in driver model class.c
2003-06-11 21:51 ` Greg KH
@ 2003-06-11 21:54 ` Patrick Mochel
0 siblings, 0 replies; 4+ messages in thread
From: Patrick Mochel @ 2003-06-11 21:54 UTC (permalink / raw)
To: Greg KH; +Cc: Alan Stern, linux-kernel
On Wed, 11 Jun 2003, Greg KH wrote:
> On Wed, Jun 11, 2003 at 01:12:47PM -0400, Alan Stern wrote:
> > Greg:
> >
> > There is a bug in drivers/base/class.c in 2.5.70. Near the start of the
> > routine class_device_add() are the lines
> >
> > if (class_dev->dev)
> > get_device(class_dev->dev);
> >
> > But there's nothing to undo this get_device, either in the error return
> > part of class_device_add() or in class_device_del().
> >
> > I assume that either this get_device() doesn't belong there or else there
> > should be corresponding put_device() calls in the other two spots.
> > Whichever is the case, it should be easy for you to fix.
>
> You are correct. I took out the other put_device() in the -bk tree in
> class_device_del() but forgot to remove this one. Good catch.
>
> Pat, here's a patch to fix this up, against the latest -bk tree.
Applied, thanks,
-pat
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-06-11 21:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-11 17:12 BUG in driver model class.c Alan Stern
2003-06-11 17:18 ` Greg KH
2003-06-11 21:51 ` Greg KH
2003-06-11 21:54 ` Patrick Mochel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox