From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752762AbbJXW1z (ORCPT ); Sat, 24 Oct 2015 18:27:55 -0400 Received: from mail-qg0-f45.google.com ([209.85.192.45]:36744 "EHLO mail-qg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752447AbbJXW1x (ORCPT ); Sat, 24 Oct 2015 18:27:53 -0400 Date: Sat, 24 Oct 2015 15:26:26 -0700 From: Dmitry Torokhov To: David Herrmann Cc: Stephen Chandler Paul , linux-kernel , Linux API , Andrew Morton , Mauro Carvalho Chehab , Greg KH , Arnd Bergmann , Joe Perches , Jiri Slaby , Vishnu Patekar , Sebastian Ott , Benjamin Tissoires , Hans de Goede , linux-doc@vger.kernel.org Subject: Re: [PATCH v7] Input: Add userio module Message-ID: <20151024222626.GA18702@dtor-pixel> References: <20151002173714.GA8437@dtor-ws> <1444060529-11164-1-git-send-email-cpaul@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 08, 2015 at 07:20:59PM +0200, David Herrmann wrote: > On Mon, Oct 5, 2015 at 5:55 PM, wrote: > > +static int userio_char_release(struct inode *inode, struct file *file) > > +{ > > + struct userio_device *userio = file->private_data; > > + > > + /* Don't free the serio port here, serio_unregister_port() does > > + * this for us */ > > + if (userio->running) > > + serio_unregister_port(userio->serio); > > + else > > + kfree(userio->serio); > > + > > + kfree(userio); > > I'm not very familiar with the serio-subsystem, but is there a > guarantee that .write() will not be called once unregistered? I can > see that it's not scheduled by userio anymore, but maybe there's an > async path that can trigger .write() callbacks. Dunno.. I'll leave > that to Dmitry. I think this is OK. When port is unregistered we the driver will be disconnected from it, and is not supposed to call serio_write() anymore. In fact, it should not access port after calling serio_close(). If it keeps the pointer and uses it is a bug in the other driver; we can't really do much about it. Thanks. -- Dmitry