]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
zloop: check for spurious options passed to remove
authorChristoph Hellwig <hch@lst.de>
Tue, 24 Feb 2026 14:21:45 +0000 (06:21 -0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 24 Feb 2026 21:50:18 +0000 (14:50 -0700)
Zloop uses a command option parser for all control commands,
but most options are only valid for adding a new device.  Check
for incorrectly specified options in the remove handler.

Fixes: eb0570c7df23 ("block: new zoned loop block device driver")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/zloop.c

index ae9bf2a85c21cbe484d4e4aca5f5114c55a1b635..9e3bb538d5fcfc36974e202153c9e64e6a8685c6 100644 (file)
@@ -1174,7 +1174,12 @@ static int zloop_ctl_remove(struct zloop_options *opts)
        int ret;
 
        if (!(opts->mask & ZLOOP_OPT_ID)) {
-               pr_err("No ID specified\n");
+               pr_err("No ID specified for remove\n");
+               return -EINVAL;
+       }
+
+       if (opts->mask & ~ZLOOP_OPT_ID) {
+               pr_err("Invalid option specified for remove\n");
                return -EINVAL;
        }