mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Amit Shah <amit@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Thomas Gleixner <tglx@kernel.org>,
	linux-kernel@vger.kernel.org, virtualization@lists.linux.dev,
	Sungho Bae <baver.bae@lge.com>
Subject: [PATCH] virtio_console: Fix alloc_buf(.gfp) usage
Date: Fri, 28 Aug 2026 17:37:06 +0200	[thread overview]
Message-ID: <20260828153706.GR687043@noisy.programming.kicks-ass.net> (raw)


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;
 

             reply	other threads:[~2026-08-28 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28 15:37 Peter Zijlstra [this message]
2026-08-29  6:14 ` 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=20260828153706.GR687043@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=amit@kernel.org \
    --cc=arnd@arndb.de \
    --cc=baver.bae@lge.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@kernel.org \
    --cc=virtualization@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

all inboxes | Powered by JetHome®