From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752046AbbCKP7v (ORCPT ); Wed, 11 Mar 2015 11:59:51 -0400 Received: from mx0b-000f0801.pphosted.com ([67.231.152.113]:64458 "EHLO mx0b-000f0801.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751780AbbCKP7t (ORCPT ); Wed, 11 Mar 2015 11:59:49 -0400 Message-ID: <55006668.20202@brocade.com> Date: Wed, 11 Mar 2015 15:59:36 +0000 From: Brian Russell User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.5.0 MIME-Version: 1.0 To: Greg Kroah-Hartman , Brian Russell CC: "Hans J. Koch" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] uio: Fix uio driver to refcount device References: <55005FDE.20602@brocade.com> <20150311154318.GA1238@kroah.com> In-Reply-To: <20150311154318.GA1238@kroah.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-03-11_04:2015-03-11,2015-03-11,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1503110167 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Brian > thanks, > > greg k-h >