From: sashiko-bot@kernel.org
To: "Sang-Hoon Choi" <csh0052@gmail.com>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH] tty: rpmsg: close port lookup-to-get race
Date: Tue, 22 Sep 2026 15:27:14 +0000 [thread overview]
Message-ID: <20260922152714.AE6221F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923001647.1337001-1-csh0052@gmail.com>
> rpmsg_tty_install() obtains cport from tty_idr before taking a port
> reference. rpmsg_tty_destruct_port() removes the entry under idr_lock
> and frees cport. If channel removal drops the last reference between
> idr_find() and tty_port_get(), the install path dereferences freed
> memory.
>
> The first-open path and channel removal can run concurrently. tty_mutex
> serializes TTY initialization, but rpmsg_tty_remove() does not take that
> mutex. tty_unregister_device() prevents later opens through cdev_del(),
> but cdev_del() does not wait for an open which has already entered the
> driver. Before rpmsg_tty_install() finishes, the port is not attached to
> the new TTY, so tty_port_tty_hangup() does not close this interval.
>
> RPMsg channel removal may be initiated asynchronously by the remote
> processor or transport. In the test, the local process only needs
> [ ... ]
> Fixes: 7c0408d80579 ("tty: add rpmsg driver")
> Reported-by: Changyul Lee <lcy8047@gmail.com>
> Link: https://lore.kernel.org/all/179000811428.1227592.8003229121862460039.idr-bug-84@gmail.com/
> Assisted-by: LLM
> Signed-off-by: Sang-Hoon Choi <csh0052@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923001647.1337001-1-csh0052@gmail.com?part=1
next prev parent reply other threads:[~2026-09-22 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 16:28 [RFC] tty: rpmsg: possible lookup-to-reference lifetime race Sang-Hoon Choi
2026-09-21 18:50 ` Greg Kroah-Hartman
2026-09-22 15:17 ` [PATCH] tty: rpmsg: close port lookup-to-get race Sang-Hoon Choi
2026-09-22 15:27 ` sashiko-bot [this message]
2026-09-23 9:42 ` 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=20260922152714.AE6221F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=csh0052@gmail.com \
--cc=linux-serial@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