diff options
| -rw-r--r-- | drivers/block/nbd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 3863c00372bb..14a51254c3db 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
| @@ -1239,6 +1239,9 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd, | |||
| 1239 | case NBD_SET_SOCK: | 1239 | case NBD_SET_SOCK: |
| 1240 | return nbd_add_socket(nbd, arg, false); | 1240 | return nbd_add_socket(nbd, arg, false); |
| 1241 | case NBD_SET_BLKSIZE: | 1241 | case NBD_SET_BLKSIZE: |
| 1242 | if (!arg || !is_power_of_2(arg) || arg < 512 || | ||
| 1243 | arg > PAGE_SIZE) | ||
| 1244 | return -EINVAL; | ||
| 1242 | nbd_size_set(nbd, arg, | 1245 | nbd_size_set(nbd, arg, |
| 1243 | div_s64(config->bytesize, arg)); | 1246 | div_s64(config->bytesize, arg)); |
| 1244 | return 0; | 1247 | return 0; |
