Commit 15ea7686 authored by Li Nan's avatar Li Nan
Browse files

block: add check of 'minors' and 'first_minor' in device_add_disk()

mainline inclusion
from mainline-v6.7-rc1
commit 4c434392c4777881d01beada6701eff8c76b43fe
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8SCHN

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4c434392c4777881d01beada6701eff8c76b43fe



--------------------------------------

'first_minor' represents the starting minor number of disks, and
'minors' represents the number of partitions in the device. Neither
of them can be greater than MINORMASK + 1.

Commit e338924b ("block: check minor range in device_add_disk()")
only added the check of 'first_minor + minors'. However, their sum might
be less than MINORMASK but their values are wrong. Complete the checks now.

Fixes: e338924b ("block: check minor range in device_add_disk()")
Signed-off-by: default avatarLi Nan <linan122@huawei.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231219075942.840255-1-linan666@huaweicloud.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 6c595a24
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment