From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751670AbbCKQCg (ORCPT ); Wed, 11 Mar 2015 12:02:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44983 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751531AbbCKQCe (ORCPT ); Wed, 11 Mar 2015 12:02:34 -0400 Date: Wed, 11 Mar 2015 17:02:30 +0100 From: Greg Kroah-Hartman To: Brian Russell Cc: Brian Russell , "Hans J. Koch" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] uio: Fix uio driver to refcount device Message-ID: <20150311160230.GA24028@kroah.com> References: <55005FDE.20602@brocade.com> <20150311154318.GA1238@kroah.com> <55006668.20202@brocade.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55006668.20202@brocade.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > > > 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