public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@kernel.org>
To: "D. Starke" <daniel.starke@siemens.com>,
	linux-serial@vger.kernel.org, gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] tty: n_gsm: fix missing corner cases in gsmld_poll()
Date: Thu, 7 Jul 2022 08:48:35 +0200	[thread overview]
Message-ID: <1c605fa7-dddf-fb9d-0656-286bb6830d36@kernel.org> (raw)
In-Reply-To: <20220706054452.3663-4-daniel.starke@siemens.com>

On 06. 07. 22, 7:44, D. Starke wrote:
> From: Daniel Starke <daniel.starke@siemens.com>
> 
> gsmld_poll() currently fails to handle some corner cases correctly:
> - tty ldisc association lost
> - remote party closed the associated tty
> 
> Add the missing checks and map those to EPOLLHUP.
> Reorder the checks to group them by their reaction.
> 
> Fixes: e1eaea46bb40 ("tty: n_gsm line discipline")
> Signed-off-by: Daniel Starke <daniel.starke@siemens.com>
> ---
>   drivers/tty/n_gsm.c | 10 ++++++++--
>   1 file changed, 8 insertions(+), 2 deletions(-)
> 
> Based on tty-testing.
> 
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> index 51447ccccbab..47566bd2ed6e 100644
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -3051,14 +3051,20 @@ static __poll_t gsmld_poll(struct tty_struct *tty, struct file *file,
>   	__poll_t mask = 0;
>   	struct gsm_mux *gsm = tty->disc_data;
>   
> +	if (!gsm)
> +		return EPOLLHUP;

Hmm, how can this happen? It's a tty bug if it calls ld ops after 
NULLing disc_data.

thanks,
-- 
js
suse labs

       reply	other threads:[~2022-07-07  6:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220706054452.3663-1-daniel.starke@siemens.com>
     [not found] ` <20220706054452.3663-4-daniel.starke@siemens.com>
2022-07-07  6:48   ` Jiri Slaby [this message]
2022-07-07  7:00 [PATCH 4/4] tty: n_gsm: fix missing corner cases in gsmld_poll() Starke, Daniel
2022-07-07  7:34 ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1c605fa7-dddf-fb9d-0656-286bb6830d36@kernel.org \
    --to=jirislaby@kernel.org \
    --cc=daniel.starke@siemens.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox