diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 249caaf6ce89..ad6dfed12464 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -382,6 +382,15 @@ static int nullb_update_nr_hw_queues(struct nullb_device *dev, if (!dev->nullb) return 0; + /* + * A shared tag_set is mapped via the module-wide queue counts, so a + * per-device resize is meaningless. On shrink it would also leave + * mq_map[] pointing at NULLed hctx slots, causing a NULL deref in + * blk_mq_map_swqueue(). Reject it. + */ + if (dev->shared_tags) + return -EINVAL; + /* * Make sure at least one submit queue exists. */