Re: [PATCH for-6.18/block 03/10] blk-mq: check invalid nr_requests in queue_requests_store()
From: Nilay Shroff
Date: Tue Sep 09 2025 - 07:42:23 EST
On 9/8/25 11:45 AM, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@xxxxxxxxxx>
>
> queue_requests_store() is the only caller of
> blk_mq_update_nr_requests(), and blk_mq_update_nr_requests() is the
> only caller of blk_mq_tag_update_depth(), however, they all have
> checkings for nr_requests input by user.
>
> Make code cleaner by moving all the checkings to the top function:
>
> 1) nr_requests > reserved tags;
> 2) if there is elevator, 4 <= nr_requests <= 2048;
> 3) if elevator is none, 4 <= nr_requests <= tag_set->queue_depth;
>
> Meanwhile, case 2 is the only case tags can grow and -ENOMEM might be
> returned.
>
> Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
Looks good to me:
Reviewed-by: Nilay Shroff <nilay@xxxxxxxxxxxxx>