Message ID | 20230416220339.43845-1-kch@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [V2] null_blk: Always check queue mode setting from configfs | expand |
On Sun, 16 Apr 2023 15:03:39 -0700, Chaitanya Kulkarni wrote: > Make sure to check device queue mode in the null_validate_conf() and > return error for NULL_Q_RQ as we don't allow legacy I/O path, without > this patch we get OOPs when queue mode is set to 1 from configfs, > following are repro steps :- > > modprobe null_blk nr_devices=0 > mkdir config/nullb/nullb0 > echo 1 > config/nullb/nullb0/memory_backed > echo 4096 > config/nullb/nullb0/blocksize > echo 20480 > config/nullb/nullb0/size > echo 1 > config/nullb/nullb0/queue_mode > echo 1 > config/nullb/nullb0/power > > [...] Applied, thanks! [1/1] null_blk: Always check queue mode setting from configfs commit: 63f8793ee60513a09f110ea460a6ff2c33811cdb Best regards,
diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 5d54834d8690..b195b8b9fe32 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -2000,6 +2000,11 @@ static int null_init_tag_set(struct nullb *nullb, struct blk_mq_tag_set *set) static int null_validate_conf(struct nullb_device *dev) { + if (dev->queue_mode == NULL_Q_RQ) { + pr_err("legacy IO path is no longer available\n"); + return -EINVAL; + } + dev->blocksize = round_down(dev->blocksize, 512); dev->blocksize = clamp_t(unsigned int, dev->blocksize, 512, 4096);