mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] HSI: ssi_protocol: don't cancel_work_sync() under ssi->lock in ssip_reset
@ 2026-11-11  9:04 Hyunjung Ko
  0 siblings, 0 replies; only message in thread
From: Hyunjung Ko @ 2026-11-11  9:04 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Andy Shevchenko, Kaixin Wang, linux-kernel, Hyunjung Ko, stable

ssip_reset() calls cancel_work_sync(&ssi->work) inside the
spin_lock_bh(&ssi->lock) section. cancel_work_sync() calls might_sleep(),
so running it under the bh spinlock triggers "BUG: sleeping function called
from invalid context". In addition, the cancelled work ssip_xmit_work() ->
ssip_xmit() takes ssi->lock itself, so waiting for it while holding the
lock can deadlock.

Move cancel_work_sync() out of the locked section. It still runs in
ssip_reset() before teardown, so the use-after-free fix is preserved.

Fixes: e3f88665a780 ("HSI: ssi_protocol: Fix use after free vulnerability in ssi_protocol Driver Due to Race Condition")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
---
 drivers/hsi/clients/ssi_protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 7c6ca8391a6b..96c20850fd66 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -397,11 +397,11 @@ static void ssip_reset(struct hsi_client *cl)
 	spin_unlock_bh(&ssi->lock);
 	if (test_and_clear_bit(SSIP_WAKETEST_FLAG, &ssi->flags))
 		ssi_waketest(cl, 0); /* FIXME: To be removed */
+	cancel_work_sync(&ssi->work);
 	spin_lock_bh(&ssi->lock);
 	timer_delete(&ssi->rx_wd);
 	timer_delete(&ssi->tx_wd);
 	timer_delete(&ssi->keep_alive);
-	cancel_work_sync(&ssi->work);
 	ssi->main_state = 0;
 	ssi->send_state = 0;
 	ssi->recv_state = 0;
-- 
2.43.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-11  9:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11  9:04 [PATCH] HSI: ssi_protocol: don't cancel_work_sync() under ssi->lock in ssip_reset Hyunjung Ko

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®