Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1497241pxv; Fri, 23 Jul 2021 09:41:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIT3JCRpEWPruwqLhTyfsg2i0EL64n1HiaBgTdZDWrQRRhZs9IhJdJ6gS5RKdEnSvdW1jt X-Received: by 2002:a17:907:9602:: with SMTP id gb2mr5529968ejc.119.1627058500910; Fri, 23 Jul 2021 09:41:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627058500; cv=none; d=google.com; s=arc-20160816; b=QhPF6F+V7lKBe9+sYgHRUaKv4CxlYE7WxIxUZ6kcjDmiLRDc4l+X1h6LZv69GsQ9kI BKl9HdJyNOFcYx2Gytg9agGWFS8hvEIApWxt9fFGWICt+Yh6Oa0TNo8jHijG9Lc+djaC hcQIAN8SyTkbDWe/Trwz4p/YVPQD/dW7gjIhW+FEmqkKqaoClKf/QESkk43UvfYiWMjQ ktb7fw38sOs+hhVYlZVuwnf01kky3mS2bBm4ea7nyOiJO1sFlzwS4Cb6A4qT4fUAgtZc qvhHmWTSzBGCn0jmYdoYZ4I5amQJ15xnk57p3OmSzbVhJ7RDprDnJIItnzf6gHSKE4Uq 96Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=xoaFmMWcry0iDjB3Jd/+JTszX0BLU5IfyeeCJvXKBik=; b=A6Iy2PzCIGXNl7X3vKd3ln96+IdjDYb8/hgefZnGQ1kjbiKJbk0CQBKL7V66Watkoo UAvB3NGOaSmEpgXfmQ8Ul4sMSL3h/mEG0KJV/6c7D12DpwQQPXhz5gHxmreyyXEo3NJv suLRqpleh5sAEzpG0va1oDh6qEzzd+KH6padlDK+XWbE20hWgRgxLvTv62XGV12hmOx1 dSdOTc3064yxeJVPpNmiF5ZjymfSyP/a/6IPDnVkW2URongwEd3KaDAyZouufRhlvhJr EeKBZGE4hlYwCv2OThTlbjA8pITEyiuVAREYqRkE3a7BAH/fSEd4+fPQRt2gaio41khj MRUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=jTtAg8Ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bh4si40005237ejb.680.2021.07.23.09.41.17; Fri, 23 Jul 2021 09:41:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=jTtAg8Ji; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230519AbhGWP4x (ORCPT + 99 others); Fri, 23 Jul 2021 11:56:53 -0400 Received: from mout.gmx.net ([212.227.15.15]:42059 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbhGWP4u (ORCPT ); Fri, 23 Jul 2021 11:56:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1627058232; bh=CVnvzIMltbSZVZh9Um+aC87wv4W4qAOZHLkJjIMzqMo=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=jTtAg8JihfvUAZO5P2E8+4aHGLEM35Olb94ACn3dOon5te6VEmvDk4C4MHnyaDUq/ hEcFy8m6XQG6sEcoHdsZ8GjDo4MhJDwRU9sWEFrPlmCqcmbbN1nX9h1y1Zb3r6LFHK y/VqG4JY/d0535iQVeqyD/sb+f1+cqGHNA9tS0AQ= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.20.60] ([92.116.130.19]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MWRVh-1lZaX645Ih-00XpHX; Fri, 23 Jul 2021 18:37:12 +0200 Subject: Re: [PATCH 3/8] tty: don't store semi-state into tty drivers To: Jiri Slaby , gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , "James E.J. Bottomley" , Chris Zankel , Max Filippov , Laurentiu Tudor , Felipe Balbi References: <20210723074317.32690-1-jslaby@suse.cz> <20210723074317.32690-4-jslaby@suse.cz> From: Helge Deller Message-ID: <584aafd9-843c-6f26-ae0c-3cddaff3000c@gmx.de> Date: Fri, 23 Jul 2021 18:37:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210723074317.32690-4-jslaby@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:SN7OHPumkOylbXvEtsZN83FNVE3cet8/qDwosCbhqHh+40/bLko XP87HhyiV2fUqF3KJSe3fc/bttFmlesi9RUXj8qcvClRvO6T1KeqgNNYKDdP2BRAo96DZEE SVASCnc/RDlKXHYHvbVezGOjjG/nkziLDIyRy4HAA2YXDSuE0+YOvWJhcHUz1GLb5TqsFAc lZUNmOoSUPaE/WvdFv3pQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:5zYZ07VVkr0=:2nssXwobJm42IscIFRNvWp ANm68LTonMEXAoW2aUd7WMkqN5iQ7mTUHE2ZoeloCVNj5JUXr//p+1dNCjZqLA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-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/23/21 9:43 AM, Jiri Slaby wrote: > When a tty driver pointer is used as a return value of struct > console's device() hook, don't store a semi-state into global variable > which holds the tty driver. It could mean console::device() would return > a bogus value. This is important esp. after the next patch where we > switch from alloc_tty_driver to tty_alloc_driver. tty_alloc_driver > returns ERR_PTR in case of error and that might have unexpected results > as the code doesn't expect this. > > Signed-off-by: Jiri Slaby > Cc: Geert Uytterhoeven > Cc: "James E.J. Bottomley" > Cc: Helge Deller > Cc: Chris Zankel > Cc: Max Filippov > Cc: Laurentiu Tudor > Cc: Felipe Balbi > --- > arch/m68k/emu/nfcon.c | 27 +++++++++++--------- > arch/parisc/kernel/pdc_cons.c | 28 +++++++++++---------- > arch/xtensa/platforms/iss/console.c | 33 +++++++++++++----------- > drivers/tty/amiserial.c | 35 ++++++++++++++------------ > drivers/tty/ehv_bytechan.c | 28 ++++++++++++--------- > drivers/tty/hvc/hvsi.c | 35 ++++++++++++++------------ > drivers/usb/gadget/function/u_serial.c | 32 ++++++++++++----------- > 7 files changed, 119 insertions(+), 99 deletions(-) > ... You may add: Acked-by: Helge Deller # parisc to the whole series (specifically patches 3, 4 and 8) regarding the parisc= changes. Thank you! Helge > > diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons= .c > index 39ccad063533..650cb01203de 100644 > --- a/arch/parisc/kernel/pdc_cons.c > +++ b/arch/parisc/kernel/pdc_cons.c > @@ -138,6 +138,7 @@ static struct tty_driver *pdc_console_tty_driver; > > static int __init pdc_console_tty_driver_init(void) > { > + struct tty_driver *driver; > int err; > > /* Check if the console driver is still registered. > @@ -160,31 +161,32 @@ static int __init pdc_console_tty_driver_init(void= ) > printk(KERN_INFO "The PDC console driver is still registered, removin= g CON_BOOT flag\n"); > pdc_cons.flags &=3D ~CON_BOOT; > > - pdc_console_tty_driver =3D alloc_tty_driver(1); > - > - if (!pdc_console_tty_driver) > + driver =3D alloc_tty_driver(1); > + if (!driver) > return -ENOMEM; > > tty_port_init(&tty_port); > > - pdc_console_tty_driver->driver_name =3D "pdc_cons"; > - pdc_console_tty_driver->name =3D "ttyB"; > - pdc_console_tty_driver->major =3D MUX_MAJOR; > - pdc_console_tty_driver->minor_start =3D 0; > - pdc_console_tty_driver->type =3D TTY_DRIVER_TYPE_SYSTEM; > - pdc_console_tty_driver->init_termios =3D tty_std_termios; > - pdc_console_tty_driver->flags =3D TTY_DRIVER_REAL_RAW | > + driver->driver_name =3D "pdc_cons"; > + driver->name =3D "ttyB"; > + driver->major =3D MUX_MAJOR; > + driver->minor_start =3D 0; > + driver->type =3D TTY_DRIVER_TYPE_SYSTEM; > + driver->init_termios =3D tty_std_termios; > + driver->flags =3D TTY_DRIVER_REAL_RAW | > TTY_DRIVER_RESET_TERMIOS; > - tty_set_operations(pdc_console_tty_driver, &pdc_console_tty_ops); > - tty_port_link_device(&tty_port, pdc_console_tty_driver, 0); > + tty_set_operations(driver, &pdc_console_tty_ops); > + tty_port_link_device(&tty_port, driver, 0); > > - err =3D tty_register_driver(pdc_console_tty_driver); > + err =3D tty_register_driver(driver); > if (err) { > printk(KERN_ERR "Unable to register the PDC console TTY driver\n"); > tty_port_destroy(&tty_port); > return err; > } > > + pdc_console_tty_driver =3D driver; > + > return 0; > } > device_initcall(pdc_console_tty_driver_init); ...