All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: wacom: use GFP_ATOMIC in wacom_wac_queue_flush()
@ 2026-05-30 15:59 Jinmo Yang
  2026-05-30 16:16 ` sashiko-bot
  2026-05-31  4:25 ` Dmitry Torokhov
  0 siblings, 2 replies; 7+ messages in thread
From: Jinmo Yang @ 2026-05-30 15:59 UTC (permalink / raw)
  To: Ping Cheng, Jason Gerecke, Jiri Kosina, Benjamin Tissoires
  Cc: Dmitry Torokhov, linux-input, linux-kernel, Jinmo Yang, stable

wacom_wac_queue_flush() is called via the .raw_event callback
(wacom_raw_event → wacom_wac_pen_serial_enforce → wacom_wac_queue_flush).
For USB HID devices, this callback is invoked from hid_irq_in(), which
is a URB completion handler running in atomic context. Using GFP_KERNEL
in this path can sleep, leading to a "scheduling while atomic" bug.

Use GFP_ATOMIC instead. The existing code already handles allocation
failure by skipping the fifo entry and continuing.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Fixes: 5e013ad20689 ("HID: wacom: Remove static WACOM_PKGLEN_MAX limit")
Cc: stable@vger.kernel.org
Signed-off-by: Jinmo Yang <jinmo44.yang@gmail.com>
---
 drivers/hid/wacom_sys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index a32320b35..2e237bdd2 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -74,7 +74,7 @@ static void wacom_wac_queue_flush(struct hid_device *hdev,
 		unsigned int count;
 		int err;
 
-		buf = kzalloc(size, GFP_KERNEL);
+		buf = kzalloc(size, GFP_ATOMIC);
 		if (!buf) {
 			kfifo_skip(fifo);
 			continue;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-06-01 18:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-30 15:59 [PATCH] HID: wacom: use GFP_ATOMIC in wacom_wac_queue_flush() Jinmo Yang
2026-05-30 16:16 ` sashiko-bot
2026-05-31  4:25 ` Dmitry Torokhov
2026-06-01 13:41   ` [PATCH v2 0/2] HID: wacom: fix sleeping in atomic context " Jinmo Yang
2026-06-01 13:41     ` [PATCH v2 1/2] HID: wacom: use GFP_ATOMIC " Jinmo Yang
2026-06-01 13:41     ` [PATCH v2 2/2] HID: wacom: use cleanup.h for wacom_wac_queue_flush() buffer management Jinmo Yang
2026-06-01 18:19     ` [PATCH v2 0/2] HID: wacom: fix sleeping in atomic context in wacom_wac_queue_flush() Benjamin Tissoires

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.