All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Jiri Slaby <jirislaby@kernel.org>,
	linux-serial@vger.kernel.org, lvc-project@linuxtesting.org,
	syzbot+b5d1f455d385b2c7da3c@syzkaller.appspotmail.com
Subject: Re: [PATCH 1/2] tty: n_gsm: avoid reactivation without previous cleanup
Date: Mon, 6 Jul 2026 16:35:36 +0200	[thread overview]
Message-ID: <2026070611-pamperer-traps-84d4@gregkh> (raw)
In-Reply-To: <20260706142016.3385636-1-dmantipov@yandex.ru>

On Mon, Jul 06, 2026 at 05:20:15PM +0300, Dmitry Antipov wrote:
> Initially reported by syzbot at as memory leak, actual issue is an attempt
> to configure DLCI 0 (via 'ioctl(..., GSMIOC_SETCONF_EXT, ...)') more than
> once without previous cleanup (likely requested with GSM_FL_RESTART). To
> prevent such a scenario, including racy attempts to do it from multiple
> threads, adjust 'gsm_activate_mux()' to grab GSM mux's mutex and throw
> -EBUSY if DLCI 0 was configured already.
> 
> Reported-by: syzbot+b5d1f455d385b2c7da3c@syzkaller.appspotmail.com

We've had loads of syzbot "issues" reported in this code, and unless it
actually shows up in a real device or operation, I'd just leave it alone
please as there are lots of subtle issues involved in it.

Have you tested this in real hardware?

> Closes: https://syzkaller.appspot.com/bug?extid=b5d1f455d385b2c7da3c
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
>  drivers/tty/n_gsm.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> index c13e050de83b..ce447477ccf3 100644
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c
> @@ -3186,6 +3186,11 @@ static int gsm_activate_mux(struct gsm_mux *gsm)
>  	struct gsm_dlci *dlci;
>  	int ret;
>  
> +	guard(mutex)(&gsm->mutex);
> +
> +	if (unlikely(gsm->dlci[0]))
> +		return -EBUSY;

Why unlikely()?  Can you measure it with/without that?  If not, it
should never be used.

thanks,

greg k-h

  parent reply	other threads:[~2026-07-06 14:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 14:20 [PATCH 1/2] tty: n_gsm: avoid reactivation without previous cleanup Dmitry Antipov
2026-07-06 14:20 ` [PATCH 2/2] tty: n_gsm: issue mutex_destroy() from gsm_dlci_free() Dmitry Antipov
2026-07-07  3:24   ` Jiri Slaby
2026-07-06 14:35 ` Greg Kroah-Hartman [this message]
2026-07-06 14:49   ` [PATCH 1/2] tty: n_gsm: avoid reactivation without previous cleanup Dmitry Antipov
2026-07-06 15:18     ` Greg Kroah-Hartman
2026-07-07  5:47       ` Dmitry Antipov
2026-07-07  5:58         ` Greg Kroah-Hartman

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=2026070611-pamperer-traps-84d4@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dmantipov@yandex.ru \
    --cc=jirislaby@kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=syzbot+b5d1f455d385b2c7da3c@syzkaller.appspotmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.