All of lore.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+95fdab36405e5ffdb680@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Forwarded: [PATCH] BUG: sleeping function called from invalid context in null_insert_page
Date: Wed, 16 Sep 2026 18:15:06 -0700	[thread overview]
Message-ID: <6aab3f1a.b398a7c9.1f86be.0001.GAE@google.com> (raw)
In-Reply-To: <6a9b44e0.a5e650b3.363816.0002.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.

***

Subject: [PATCH] BUG: sleeping function called from invalid context in null_insert_page
Author: jchuang26@m.fudan.edu.cn

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master

Reported-by: syzbot+95fdab36405e5ffdb680@syzkaller.appspotmail.com

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 6beb1f5b7..d5ece457e 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -1861,8 +1861,17 @@ static int null_init_global_tag_set(void)
 		tag_set.flags |= BLK_MQ_F_NO_SCHED_BY_DEFAULT;
 	if (g_shared_tag_bitmap)
 		tag_set.flags |= BLK_MQ_F_TAG_HCTX_SHARED;
-	if (g_blocking)
-		tag_set.flags |= BLK_MQ_F_BLOCKING;
+
+	/*
+	 * A shared tag set may be used by a memory backed device, whose
+	 * ->queue_rq() performs GFP_NOIO allocations and therefore must be
+	 * allowed to sleep.  blk-mq picks its locking (RCU or SRCU) from
+	 * BLK_MQ_F_BLOCKING, so always mark the shared tag set blocking;
+	 * otherwise I/O submitted through blk_mq_run_dispatch_ops() runs
+	 * under the RCU read lock and triggers "sleeping function called
+	 * from invalid context" in null_alloc_page().
+	 */
+	tag_set.flags |= BLK_MQ_F_BLOCKING;
 
 	error = null_init_tag_set(&tag_set, g_poll_queues);
 	if (error)

      parent reply	other threads:[~2026-09-17  1:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04 22:23 [syzbot] [block?] BUG: sleeping function called from invalid context in null_insert_page syzbot
2026-09-09 21:35 ` syzbot
2026-09-14 10:22 ` Forwarded: [PATCH] " syzbot
2026-09-14 10:43 ` syzbot
2026-09-15  1:38 ` syzbot
2026-09-17  1:15 ` syzbot [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=6aab3f1a.b398a7c9.1f86be.0001.GAE@google.com \
    --to=syzbot+95fdab36405e5ffdb680@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 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.