aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/nbd.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2018-09-25 09:16:48 -0700
committerMark Brown <broonie@kernel.org>2018-09-25 09:16:48 -0700
commit8b665c82acaa5a92671c7937521b2adc909bf40d (patch)
treebf090b90bdaa8e4f40ae44107247a83f850c6bb0 /drivers/block/nbd.c
parente5a0a3460305fa0be3bbddfe4c536bdf871528bf (diff)
parent917fa4e672939669f74f1c879b3aae6239f6719b (diff)
Merge tag 'v4.14.71-rt44' into linux-linaro-lsk-v4.14-rt
Linux 4.14.71-rt44
Diffstat (limited to 'drivers/block/nbd.c')
-rw-r--r--drivers/block/nbd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5e55d03d3d01..fe1414df0f33 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1228,6 +1228,9 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
case NBD_SET_SOCK:
return nbd_add_socket(nbd, arg, false);
case NBD_SET_BLKSIZE:
+ if (!arg || !is_power_of_2(arg) || arg < 512 ||
+ arg > PAGE_SIZE)
+ return -EINVAL;
nbd_size_set(nbd, arg,
div_s64(config->bytesize, arg));
return 0;