[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251215142118.GA19970@fedora>
Date: Mon, 15 Dec 2025 09:21:18 -0500
From: Stefan Hajnoczi <stefanha@...hat.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Deepanshu Kartikey <kartikey406@...il.com>, axboe@...nel.dk,
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 Sun, Dec 14, 2025 at 09:33:59PM -0800, Christoph Hellwig wrote:
> 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?
Yes, that's good. Thanks for looking into this, Deepanshu.
Stefan
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists