Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-30 Thread Greg KH
On Wed, Oct 30, 2013 at 02:41:16PM -0700, Eric W. Biederman wrote: > One of the particularly problematic things that can happen with sysfs is > that we can get a hotplug event in userspace and then examine sysfs and > not find the attributes of the device because the kernel has not added > them yet

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-30 Thread Tejun Heo
Hey, Eric. On Wed, Oct 30, 2013 at 02:41:16PM -0700, Eric W. Biederman wrote: > Being nice here has resulted in buggy semantics exported to userspace, > and buggy kernel code being written. In a generalized version of sysfs > we don't want to be nice to avoid the existing mess that sysfs sees. H

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-30 Thread Eric W. Biederman
Greg KH writes: > From: Greg Kroah-Hartman > > Linus noticed that the assignment of sd isn't protected by the lock in > sysfs_remove_dir(), so move the assignment of the variable under the > lock to be safe. > > Reported-by: Linus Torvalds > Signed-off-by: Greg Kroah-Hartman Reviewed-by: "Eri

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-30 Thread Eric W. Biederman
Tejun Heo writes: > Hello, > > On Tue, Oct 29, 2013 at 10:29:43PM -0700, Eric W. Biederman wrote: >> I never actually looked deeply into it, and I was working from several >> year old memory and a quick skim of the patch when I asked the question. >> >> The protection we have previous to this pa

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-30 Thread Tejun Heo
Hello, On Tue, Oct 29, 2013 at 10:29:43PM -0700, Eric W. Biederman wrote: > I never actually looked deeply into it, and I was working from several > year old memory and a quick skim of the patch when I asked the question. > > The protection we have previous to this patch is that syfs_remove_dir i

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-30 Thread Tejun Heo
Hey, guys. On Tue, Oct 29, 2013 at 03:09:39PM -0700, Greg KH wrote: > From: Greg Kroah-Hartman > > Linus noticed that the assignment of sd isn't protected by the lock in > sysfs_remove_dir(), so move the assignment of the variable under the > lock to be safe. > > Reported-by: Linus Torvalds >

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-29 Thread Eric W. Biederman
Linus Torvalds writes: > On Tue, Oct 29, 2013 at 5:39 PM, Eric W. Biederman > wrote: >> >> I don't have a strong feeling either way but how would that matter? >> There is only ever one sd associated with a kobj. > > What does that matter? If you have multiple callers, they might try to > free th

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-29 Thread Linus Torvalds
On Tue, Oct 29, 2013 at 5:39 PM, Eric W. Biederman wrote: > > I don't have a strong feeling either way but how would that matter? > There is only ever one sd associated with a kobj. What does that matter? If you have multiple callers, they might try to free that one sd twice, since they could bot

Re: [PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-29 Thread Eric W. Biederman
Greg KH writes: > From: Greg Kroah-Hartman > > Linus noticed that the assignment of sd isn't protected by the lock in > sysfs_remove_dir(), so move the assignment of the variable under the > lock to be safe. I don't have a strong feeling either way but how would that matter? There is only ever

[PATCH] sysfs: move assignment to be under lock in sysfs_remove_dir()

2013-10-29 Thread Greg KH
From: Greg Kroah-Hartman Linus noticed that the assignment of sd isn't protected by the lock in sysfs_remove_dir(), so move the assignment of the variable under the lock to be safe. Reported-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- Tejun, any objection to this patch? You cons