From: Suyuan Wang via B4 Relay <devnull+shyckless.gmail.com@kernel.org>
To: tsbogend@alpha.franken.de
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] MIPS: rtlx: Call finish_wait() when rtlx_open() is interrupted
Date: Sat, 21 Nov 2026 15:33:02 +0000 [thread overview]
Message-ID: <20261121-rtlx-v1-2-bc05d6763ec1@gmail.com> (raw)
In-Reply-To: <20261121-rtlx-v1-0-bc05d6763ec1@gmail.com>
From: Suyuan Wang <stevewong@hust.edu.cn>
While rtlx_open() waits for the SP program, it calls prepare_to_wait()
with a wait entry on its own stack. If a signal is pending, it leaves
the loop with:
ret = -ERESTARTSYS;
goto out_fail;
and skips finish_wait(). The stack wait entry stays on
channel_wqs[index].lx_queue after rtlx_open() returns, and the task is
still in TASK_INTERRUPTIBLE state. A later wake up of that queue then
walks a stale stack entry.
Call finish_wait() before leaving the loop on a signal.
Found with a static analysis tool and checked by hand.
Fixes: 9e3468202657 ("[MIPS] RTLX: Don't use volatile; it's fragile.")
Cc: stable@vger.kernel.org
Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
---
arch/mips/kernel/rtlx.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index a1da56163f19..d5ea99bde129 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -138,6 +138,8 @@ int rtlx_open(int index, int can_sleep)
schedule();
continue;
}
+ finish_wait(&channel_wqs[index].lx_queue,
+ &wait);
ret = -ERESTARTSYS;
goto out_fail;
}
--
2.34.1
prev parent reply other threads:[~2026-11-21 15:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 15:33 [PATCH 0/2] MIPS: rtlx: Fix two error paths in rtlx_open() Suyuan Wang via B4 Relay
2026-11-21 15:33 ` [PATCH 1/2] MIPS: rtlx: Drop in_open count when rtlx_init() fails Suyuan Wang via B4 Relay
2026-11-21 15:33 ` Suyuan Wang via B4 Relay [this message]
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=20261121-rtlx-v1-2-bc05d6763ec1@gmail.com \
--to=devnull+shyckless.gmail.com@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=shyckless@gmail.com \
--cc=tsbogend@alpha.franken.de \
/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
all inboxes | Powered by JetHome®