]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Sep 2018 20:41:20 +0000 (22:41 +0200)
commit56935391aba9292b1b6a30e81c4f42495b3120b7
treeef8bba9075c93375bc0e39d1fac5fdf2f18d5320
parente847a545edae1a88bd58c828746a23878a1550c1
nbd: don't allow invalid blocksize settings

commit bc811f05d77f47059c197a98b6ad242eb03999cb upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/nbd.c