mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] virtio_console: Fix alloc_buf(.gfp) usage
@ 2026-08-28 15:37 Peter Zijlstra
  2026-08-29  6:14 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Zijlstra @ 2026-08-28 15:37 UTC (permalink / raw)
  To: Amit Shah, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Thomas Gleixner, linux-kernel, virtualization, Sungho Bae


Commit fc220d6be3c7 ("virtio_console: refactor __send_to_port() buffer
ownership") added a .gfp argument to alloc_buf(), but forgot to convert
all allocation calls.

The result is that any GFP_ATOMIC calls, such as those from:

  hvc_console_print()
    put_chars()
      alloc_buf(.gfp = GFP_ATOMIC)

will trip the might_sleep_if() check when used from an atomic context.

Fixes: fc220d6be3c7 ("virtio_console: refactor __send_to_port() buffer
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 62eecfa61646..7f6cbe851d1e 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -426,7 +426,7 @@ static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size
 	 * Allocate buffer and the sg list. The sg list array is allocated
 	 * directly after the port_buffer struct.
 	 */
-	buf = kmalloc_flex(*buf, sg, pages);
+	buf = kmalloc_flex(*buf, sg, pages, gfp);
 	if (!buf)
 		goto fail;
 

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

end of thread, other threads:[~2026-08-29  6:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-28 15:37 [PATCH] virtio_console: Fix alloc_buf(.gfp) usage Peter Zijlstra
2026-08-29  6:14 ` Greg Kroah-Hartman

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®