Re: [PATCH] uio: Fix uio driver to refcount device

From: Greg Kroah-Hartman
Date: Wed Mar 11 2015 - 12:02:40 EST


On Wed, Mar 11, 2015 at 03:59:36PM +0000, Brian Russell wrote:
>
>
> On 11/03/15 15:43, Greg Kroah-Hartman wrote:
> > On Wed, Mar 11, 2015 at 03:31:42PM +0000, Brian Russell wrote:
> >> Protect uio driver from crashing if its owner is hot unplugged while there
> >> are open fds.
> >> Signed-off-by: Brian Russell <brussell@xxxxxxxxxxx>
> >
> > Minor nit, you need a blank line before your s-o-b: line.
> >
>
> Ack.
>
> >
> >
> >> ---
> >> drivers/uio/uio.c | 8 +++++++-
> >> 1 file changed, 7 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
> >> index 6276f13..70ce015 100644
> >> --- a/drivers/uio/uio.c
> >> +++ b/drivers/uio/uio.c
> >> @@ -434,9 +434,11 @@ static int uio_open(struct inode *inode, struct file *filep)
> >> goto out;
> >> }
> >>
> >> + get_device(idev);
> >
> > What is the real oops caused when a device is removed? Protecting this
> > with a reference count seems ok, but it seems "heavy".
> >
>
> I'm seeing it with PCI hotplug. The PCI subsystem calls remove and the
> owner module in turn calls uio_unregister_device while app stil has
> open fds.

Sorry, I meant, what exactly is the oops message, with the callback?
What portion of code is crashing because we have an open fd? The pci
remove path of the UIO core should be fixed to handle this properly.
Not to say that your patch isn't correct, just want to see the crash to
know for sure.

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/