public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Florian Faber <faber@faberman.de>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: u_serial: Fix possible null pointer dereference
Date: Mon, 20 Sep 2021 06:57:59 +0200	[thread overview]
Message-ID: <YUgU10Q/HrHJtASV@kroah.com> (raw)
In-Reply-To: <863b03b7-d00a-0af1-c21e-e2f7930bb0b3@faberman.de>

On Sun, Sep 19, 2021 at 09:57:28PM +0200, Florian Faber wrote:
> In gs_rx_push, tty can be null. tty_throttled accesses tty->flags without further testing, which would lead to a null pointer dereference.

Please wrap your changelog text to 72 columns.

> 
> Signed-off-by: Florian Faber <faber@faberman.de>
> ---
>  drivers/usb/gadget/function/u_serial.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
> index 6f68cbeeee7c..00512e7c7261 100644
> --- a/drivers/usb/gadget/function/u_serial.c
> +++ b/drivers/usb/gadget/function/u_serial.c
> @@ -436,7 +436,7 @@ static void gs_rx_push(struct work_struct *work)
>  	 * We may leave non-empty queue only when there is a tty, and
>  	 * either it is throttled or there is no more room in flip buffer.
>  	 */
> -	if (!list_empty(queue) && !tty_throttled(tty))
> +	if (tty && !list_empty(queue) && !tty_throttled(tty))

Have you ever been able to trigger this with a NULL tty?

thanks,

greg k-h

  reply	other threads:[~2021-09-20  4:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19 19:57 [PATCH] usb: gadget: u_serial: Fix possible null pointer dereference Florian Faber
2021-09-20  4:57 ` Greg KH [this message]
2021-09-20  8:36   ` Florian Faber

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=YUgU10Q/HrHJtASV@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=faber@faberman.de \
    --cc=linux-usb@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