]> git.baikalelectronics.ru Git - kernel.git/commit
nbd: don't allow invalid blocksize settings
authorJens Axboe <axboe@kernel.dk>
Tue, 4 Sep 2018 17:52:34 +0000 (11:52 -0600)
committerJens Axboe <axboe@kernel.dk>
Tue, 4 Sep 2018 17:54:58 +0000 (11:54 -0600)
commit9ee99650764966a97f573c723032f0fba3ac15ae
treee96cabff009625665432d1b98fba898eabaa89ba
parent7770dffd9ca3703c86f2c050e29f7e61e64a58db
nbd: don't allow invalid blocksize settings

syzbot reports a divide-by-zero off the NBD_SET_BLKSIZE ioctl.
We need proper validation of the input here. Not just if it's
zero, but also if the value is a power-of-2 and in a valid
range. Add that.

Cc: stable@vger.kernel.org
Reported-by: syzbot <syzbot+25dbecbec1e62c6b0dd4@syzkaller.appspotmail.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c