From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751367AbdEOKb2 (ORCPT ); Mon, 15 May 2017 06:31:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51004 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750822AbdEOKb1 (ORCPT ); Mon, 15 May 2017 06:31:27 -0400 Date: Mon, 15 May 2017 12:31:18 +0200 From: Greg Kroah-Hartman To: Okash Khawaja Cc: Jiri Slaby , Samuel Thibault , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, Kirk Reiser , Chris Brannon , speakup@linux-speakup.org Subject: Re: [patch 2/6] tty: export tty_open_by_driver Message-ID: <20170515103118.GA10885@kroah.com> References: <20170429195257.630355823@gmail.com> <20170429195403.522579504@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170429195403.522579504@gmail.com> User-Agent: Mutt/1.8.2 (2017-04-18) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 29, 2017 at 08:52:59PM +0100, Okash Khawaja wrote: > This applies on top of the changes already in staging-next branch which allow > kernel access to TTY dev. > > Signe-doff-by: Okash Khawaja > Reviewed-by: Samuel Thibault > > Index: linux-staging/drivers/tty/tty_io.c > =================================================================== > --- linux-staging.orig/drivers/tty/tty_io.c > +++ linux-staging/drivers/tty/tty_io.c > @@ -1369,7 +1369,10 @@ static struct tty_struct *tty_driver_loo > struct tty_struct *tty; > > if (driver->ops->lookup) > - tty = driver->ops->lookup(driver, file, idx); > + if (!file) > + tty = ERR_PTR(-EIO); > + else > + tty = driver->ops->lookup(driver, file, idx); Why make this change? Shouldn't the lookup function allow a NULL file pointer? Or is the problem that they do not? > else > tty = driver->ttys[idx]; > > @@ -2001,7 +2004,7 @@ static struct tty_driver *tty_lookup_dri > struct tty_driver *console_driver = console_device(index); > if (console_driver) { > driver = tty_driver_kref_get(console_driver); > - if (driver) { > + if (driver && filp) { Why change this too? Your changelog does not explain any of this, please do so. thanks, greg k-h