From: sashiko-bot@kernel.org
To: "Krystian Kaniewski" <krystianmkaniewski@gmail.com>,
linux-usb@vger.kernel.org
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2] usb: gadget: u_serial: pin ports while TTYs are installed
Date: Thu, 22 Oct 2026 09:37:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-181270@kernel.org> (raw)
In-Reply-To: <20261022091359.1187468-1-krystianmkaniewski@gmail.com>
> A slab-use-after-free can occur when gserial_free_line() frees struct
> gs_port while it is still reachable through an installed TTY. The
> port->port.count value tracks successful opens, but it is zero before
> gs_open() and again after gs_close(), before TTY cleanup has finished.
> Teardown can therefore free gs_port while tty_init_dev() or release_tty()
> still accesses its tty_port.
>
> Manage gs_port lifetime with tty_port references. Take a reference in
> gs_install(), drop it in gs_cleanup(), and move the final free to
> gs_port_destruct(). Unregister the TTY device before dropping the owner
> reference.
>
> Keep each minor reserved until the old port is destroyed so an installed
> TTY for one generation cannot overlap a replacement at the same minor.
> Publish the new port before device registration so the cdev and add uevent
> [ ... ]
> Reported-by: syzbot+fe63e4d633540f230624@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=fe63e4d633540f230624
> Link: https://syzkaller.appspot.com/ai_job?id=ec789387-2e7b-4a8f-a7a1-a47bf7fa57f5
> Cc: stable@kernel.org
> Signed-off-by: Krystian Kaniewski <krystianmkaniewski@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261022091359.1187468-1-krystianmkaniewski@gmail.com?part=1
next prev parent reply other threads:[~2026-10-22 9:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 15:54 [PATCH] usb: gadget: u_serial: pin ports while TTYs are installed syzbot
2026-10-21 6:17 ` Mehmet Fide
2026-10-22 9:13 ` [PATCH v2] " Krystian Kaniewski
2026-10-22 9:37 ` sashiko-bot [this message]
2026-10-23 16:21 ` Mehmet Fide
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=sashiko-outbox-181270@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=krystianmkaniewski@gmail.com \
--cc=linux-serial@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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