[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0912041148150.3070-100000@iolanthe.rowland.org>
Date: Fri, 4 Dec 2009 11:57:57 -0500 (EST)
From: Alan Stern <stern@...land.harvard.edu>
To: Oliver Neukum <oliver@...kum.org>
cc: Greg KH <gregkh@...e.de>, <stable@...nel.org>,
Rickard Bellini <rickard.bellini@...csson.com>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
Torgny Johansson <torgny.johansson@...csson.com>,
Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] Driver core: fix race in dev_driver_string
On Fri, 4 Dec 2009, Oliver Neukum wrote:
> Am Freitag, 4. Dezember 2009 17:06:57 schrieb Alan Stern:
> > Oliver:
> >
> > We don't have to worry about the device structure being deallocated
> > while the routine is running. If that happens it's a bug in the
> > caller: improper refcounting.
>
> That raises two points
>
> 1. am I supposed to get a reference just so that I can use dev_err?
You're supposed to hold a reference before using dev at all. If the
only use you make of dev is to call dev_err(), then yes.
That's how refcounting is meant to work.
> 2. what happens if this is a soft disconnect and the device is reconnected?
> It seems to me that you'd print the wrong driver's name.
You mean the device is unbound from driver A and then bound to driver
B, after which a thread running in driver A calls dev_err()? Then yes,
the "wrong" name will be printed.
This is part of the idea behind dev_err() and friends. They print the
name of the currently bound driver, not the name of the calling source
file. That's why, for example, the name "usb-storage" shows up in a
message printed from within usbcore rather than "hub.c".
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists