Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-11 Thread Greg KH
On Mon, Dec 11, 2006 at 04:13:06PM +0530, Maneesh Soni wrote: > On Mon, Dec 04, 2006 at 11:06:41AM -0500, Alan Stern wrote: > > On Mon, 4 Dec 2006, Maneesh Soni wrote: > > > > > hmm, I guess Greg has to say the final word. The question is either to > > > fail > > > the IO (-ENODEV) or fail the

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-11 Thread Maneesh Soni
On Mon, Dec 04, 2006 at 11:06:41AM -0500, Alan Stern wrote: > On Mon, 4 Dec 2006, Maneesh Soni wrote: > > > hmm, I guess Greg has to say the final word. The question is either to fail > > the IO (-ENODEV) or fail the file removal (-EBUSY). If we are not going to > > fail the removal then your

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-11 Thread Maneesh Soni
On Mon, Dec 04, 2006 at 11:06:41AM -0500, Alan Stern wrote: On Mon, 4 Dec 2006, Maneesh Soni wrote: hmm, I guess Greg has to say the final word. The question is either to fail the IO (-ENODEV) or fail the file removal (-EBUSY). If we are not going to fail the removal then your patch is

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-11 Thread Greg KH
On Mon, Dec 11, 2006 at 04:13:06PM +0530, Maneesh Soni wrote: On Mon, Dec 04, 2006 at 11:06:41AM -0500, Alan Stern wrote: On Mon, 4 Dec 2006, Maneesh Soni wrote: hmm, I guess Greg has to say the final word. The question is either to fail the IO (-ENODEV) or fail the file removal

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Greg KH
On Mon, Dec 04, 2006 at 06:34:06PM +0530, Maneesh Soni wrote: > On Mon, Dec 04, 2006 at 07:38:00AM +0100, Oliver Neukum wrote: > > Am Montag, 4. Dezember 2006 05:43 schrieb Maneesh Soni: > > > On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: > > > > Hi, > > > > > > > > Alan Stern has

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 17:57 schrieb Alan Stern: > I was referring to sysfs_remove_file(), not sysfs_open_file() -- I agree > that getting rid of the check_perm() routine is good. But this isn't: > > > void sysfs_remove_file(struct kobject * kobj, const struct attribute * > > attr) > >

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Alan Stern
On Mon, 4 Dec 2006, Oliver Neukum wrote: > > Also, Oliver, it looks like the latest version of your patch makes an > > unnecessary change to sysfs_remove_file(). > > Code like: > > int d(int a, int b) > { > return a + b; > } > > int c(int a, int b) > { > return d(a, b); > } > >

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 17:06 schrieb Alan Stern: > On Mon, 4 Dec 2006, Maneesh Soni wrote: > > > hmm, I guess Greg has to say the final word. The question is either to fail > > the IO (-ENODEV) or fail the file removal (-EBUSY). If we are not going to > > fail the removal then your patch is

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Alan Stern
On Mon, 4 Dec 2006, Maneesh Soni wrote: > hmm, I guess Greg has to say the final word. The question is either to fail > the IO (-ENODEV) or fail the file removal (-EBUSY). If we are not going to > fail the removal then your patch is the way to go. > > Greg? Oliver is right that we cannot allow

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 14:04 schrieb Maneesh Soni: > > > Hi Oliver, > > > > > > Thanks for the explaining the patch but some description about the race > > > would also help here. At the least the callpath to the race would be > > > useful. > > > > > > > > > Thanks > > > Maneesh > > > > We

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Maneesh Soni
On Mon, Dec 04, 2006 at 07:38:00AM +0100, Oliver Neukum wrote: > Am Montag, 4. Dezember 2006 05:43 schrieb Maneesh Soni: > > On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: > > > Hi, > > > > > > Alan Stern has discovered a race in sysfs, whereby driver callbacks could > > > be > >

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Maneesh Soni
On Mon, Dec 04, 2006 at 07:38:00AM +0100, Oliver Neukum wrote: Am Montag, 4. Dezember 2006 05:43 schrieb Maneesh Soni: On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: Hi, Alan Stern has discovered a race in sysfs, whereby driver callbacks could be called after

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 14:04 schrieb Maneesh Soni: Hi Oliver, Thanks for the explaining the patch but some description about the race would also help here. At the least the callpath to the race would be useful. Thanks Maneesh We have code like this:  static

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Alan Stern
On Mon, 4 Dec 2006, Maneesh Soni wrote: hmm, I guess Greg has to say the final word. The question is either to fail the IO (-ENODEV) or fail the file removal (-EBUSY). If we are not going to fail the removal then your patch is the way to go. Greg? Oliver is right that we cannot allow

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 17:06 schrieb Alan Stern: On Mon, 4 Dec 2006, Maneesh Soni wrote: hmm, I guess Greg has to say the final word. The question is either to fail the IO (-ENODEV) or fail the file removal (-EBUSY). If we are not going to fail the removal then your patch is the way

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Alan Stern
On Mon, 4 Dec 2006, Oliver Neukum wrote: Also, Oliver, it looks like the latest version of your patch makes an unnecessary change to sysfs_remove_file(). Code like: int d(int a, int b) { return a + b; } int c(int a, int b) { return d(a, b); } is a detrimental to

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 17:57 schrieb Alan Stern: I was referring to sysfs_remove_file(), not sysfs_open_file() -- I agree that getting rid of the check_perm() routine is good. But this isn't: void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr) { -

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-04 Thread Greg KH
On Mon, Dec 04, 2006 at 06:34:06PM +0530, Maneesh Soni wrote: On Mon, Dec 04, 2006 at 07:38:00AM +0100, Oliver Neukum wrote: Am Montag, 4. Dezember 2006 05:43 schrieb Maneesh Soni: On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: Hi, Alan Stern has discovered a race

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-03 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 05:43 schrieb Maneesh Soni: > On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: > > Hi, > > > > Alan Stern has discovered a race in sysfs, whereby driver callbacks could be > > called after sysfs_remove_file() has run. The attached patch should fix it. > >

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-03 Thread Maneesh Soni
On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: > Hi, > > Alan Stern has discovered a race in sysfs, whereby driver callbacks could be > called after sysfs_remove_file() has run. The attached patch should fix it. > > It introduces a new data structure acting as a collection of all

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-03 Thread Maneesh Soni
On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: Hi, Alan Stern has discovered a race in sysfs, whereby driver callbacks could be called after sysfs_remove_file() has run. The attached patch should fix it. It introduces a new data structure acting as a collection of all

Re: race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-03 Thread Oliver Neukum
Am Montag, 4. Dezember 2006 05:43 schrieb Maneesh Soni: On Fri, Dec 01, 2006 at 11:43:06PM +0100, Oliver Neukum wrote: Hi, Alan Stern has discovered a race in sysfs, whereby driver callbacks could be called after sysfs_remove_file() has run. The attached patch should fix it. It

race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-01 Thread Oliver Neukum
Hi, Alan Stern has discovered a race in sysfs, whereby driver callbacks could be called after sysfs_remove_file() has run. The attached patch should fix it. It introduces a new data structure acting as a collection of all sysfs_buffers associated with an attribute. Upon removal of an attribute

race in sysfs between sysfs_remove_file() and read()/write() #2

2006-12-01 Thread Oliver Neukum
Hi, Alan Stern has discovered a race in sysfs, whereby driver callbacks could be called after sysfs_remove_file() has run. The attached patch should fix it. It introduces a new data structure acting as a collection of all sysfs_buffers associated with an attribute. Upon removal of an attribute