[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aT-dxw-VSqXMQR_h@infradead.org>
Date: Sun, 14 Dec 2025 21:33:59 -0800
From: Christoph Hellwig <hch@...radead.org>
To: Deepanshu Kartikey <kartikey406@...il.com>
Cc: Christoph Hellwig <hch@...radead.org>, axboe@...nel.dk,
stefanha@...hat.com, martin.petersen@...cle.com,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
syzbot+660d079d90f8a1baf54d@...kaller.appspotmail.com
Subject: Re: [PATCH] block: add allocation size check in blkdev_pr_read_keys()
On Fri, Dec 12, 2025 at 08:17:43PM +0530, Deepanshu Kartikey wrote:
> How about limiting num_keys to 64K (1u << 16)? In practice, PR keys
> are used for shared storage coordination and typical deployments have
> only a handful of hosts, so this should be more than enough for any
> realistic use case.
>
> With a bounded num_keys, the SIZE_MAX check becomes unnecessary, so
> I've removed it. Also switched to kvzalloc/kvfree to handle larger
> allocations gracefully.
>
> Something like below:
>
> +/* Limit the number of keys to prevent excessive memory allocation */
> +#define PR_KEYS_MAX_NUM (1u << 16)
Looks reasonable to me. Stefan?
Powered by blists - more mailing lists