Commit 038105a2 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

block: don't reject too large max_user_sectors in blk_validate_limits

We already cap down the actual max_sectors to the max of the hardware
and user limit, so don't reject the configuration.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJohn Garry <john.g.garry@oracle.com>
Reviewed-by: default avatarDamien Le Moal <dlemoal@kernel.org>
Link: https://lore.kernel.org/r/20240326060745.2349154-1-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent dc53d9ea
...@@ -146,8 +146,7 @@ static int blk_validate_limits(struct queue_limits *lim) ...@@ -146,8 +146,7 @@ static int blk_validate_limits(struct queue_limits *lim)
max_hw_sectors = min_not_zero(lim->max_hw_sectors, max_hw_sectors = min_not_zero(lim->max_hw_sectors,
lim->max_dev_sectors); lim->max_dev_sectors);
if (lim->max_user_sectors) { if (lim->max_user_sectors) {
if (lim->max_user_sectors > max_hw_sectors || if (lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE)
lim->max_user_sectors < PAGE_SIZE / SECTOR_SIZE)
return -EINVAL; return -EINVAL;
lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors); lim->max_sectors = min(max_hw_sectors, lim->max_user_sectors);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment