Commit 0be3840c authored by Zhong Jinghua's avatar Zhong Jinghua Committed by sanglipeng
Browse files

nbd: Add the maximum limit of allocated index in nbd_dev_add

stable inclusion
from stable-v5.10.188
commit 4a2c62c8d67cdbf42f217744ffa0fd9d077a589f
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8KYFP

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



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

[ Upstream commit f12bc113 ]

If the index allocated by idr_alloc greater than MINORMASK >> part_shift,
the device number will overflow, resulting in failure to create a block
device.

Fix it by imiting the size of the max allocation.

Signed-off-by: default avatarZhong Jinghua <zhongjinghua@huawei.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230605122159.2134384-1-zhongjinghua@huaweicloud.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 146ea564
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment