mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 05:04:02 +02:00
mmc: block: reject invalid perdev_minors before division
The mmcblk.perdev_minors module parameter is parsed as a signed int and is used during mmc_blk_init() to compute the number of supported block devices. Passing perdev_minors=0 makes the init path divide by zero when it computes max_devices. Negative values are invalid as well and would make max_devices negative before it is later used as an IDA limit. Reject non-positive perdev_minors values before registering any mmcblk resources. Signed-off-by: Xu Rao <raoxu@uniontech.com> Signed-off-by: Ulf Hansson <ulfh@kernel.org>
This commit is contained in:
parent
df92d47b3a
commit
5253aee00a
|
|
@ -3337,6 +3337,11 @@ static int __init mmc_blk_init(void)
|
|||
{
|
||||
int res;
|
||||
|
||||
if (perdev_minors <= 0) {
|
||||
pr_err("mmcblk: invalid minors per device: %d\n", perdev_minors);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
res = bus_register(&mmc_rpmb_bus_type);
|
||||
if (res < 0) {
|
||||
pr_err("mmcblk: could not register RPMB bus type\n");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user