Skip to content

Commit 3c46171

Browse files
Christoph Hellwigaxboe
authored andcommitted
zloop: check for spurious options passed to remove
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: eb0570c ("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>
1 parent 6acf786 commit 3c46171

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/block/zloop.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,12 @@ static int zloop_ctl_remove(struct zloop_options *opts)
11741174
int ret;
11751175

11761176
if (!(opts->mask & ZLOOP_OPT_ID)) {
1177-
pr_err("No ID specified\n");
1177+
pr_err("No ID specified for remove\n");
1178+
return -EINVAL;
1179+
}
1180+
1181+
if (opts->mask & ~ZLOOP_OPT_ID) {
1182+
pr_err("Invalid option specified for remove\n");
11781183
return -EINVAL;
11791184
}
11801185

0 commit comments

Comments
 (0)