Re: [PATCH v2 0/7] bdi: fix use-after-free for bdi device
From: Greg KH <gregkh@linuxfoundation.org>
Date: 2020-03-04 20:07:30
Also in:
linux-fsdevel
From: Greg KH <gregkh@linuxfoundation.org>
Date: 2020-03-04 20:07:30
Also in:
linux-fsdevel
On Wed, Mar 04, 2020 at 01:57:39PM -0500, Tejun Heo wrote:
Hey, Greg. On Wed, Mar 04, 2020 at 06:29:07PM +0100, Greg KH wrote:quoted
How does that happen? Who has access to a kobject without also having the reference count incremented at the same time? Is this through sysfs or somewhere within the kernel itself?Hopefully, this part was addressed in the other reply.
Yes, thanks.
quoted
The struct device refcount should be all that is needed, don't use RCU just to "delay freeing this object until some later time because someone else might have a pointer to id". That's ripe for disaster.I think it's an idiomatic use of rcu given the circumstances. Whether the circumstances are reasonable is totally debatable.
They are not reasonable :)