[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241106091345.16507-B-hca@linux.ibm.com>
Date: Wed, 6 Nov 2024 10:13:45 +0100
From: Heiko Carstens <hca@...ux.ibm.com>
To: Janosch Frank <frankja@...ux.ibm.com>
Cc: Steffen Eiden <seiden@...ux.ibm.com>, linux-kernel@...r.kernel.org,
linux-s390@...r.kernel.org, Ingo Franzki <ifranzki@...ux.ibm.com>,
Christoph Schlameuss <schlameuss@...ux.ibm.com>,
Claudio Imbrenda <imbrenda@...ux.ibm.com>, borntraeger@...ux.ibm.com
Subject: Re: [PATCH v3] s390/uvdevice: Support longer secret lists
On Wed, Nov 06, 2024 at 09:54:33AM +0100, Janosch Frank wrote:
> On 11/6/24 9:10 AM, Heiko Carstens wrote:
> > On Mon, Nov 04, 2024 at 04:36:09PM +0100, Steffen Eiden wrote:
> > > + copy_len = sizeof(list->secrets[0]) * list->num_secr_stored;
> > > + WARN_ON(copy_len > sizeof(list->secrets));
> >
> > Is this really possible? Without checking the documentation I guess
> > this is not possible and therefore the WARN_ON() should be removed.
> >
>
> This happening requires a FW error, no?
> list->num_secr_stored is reported by FW and would need to be >85.
>
> We could clamp it down to 85 secrets / 4k - sizeof(header) with a
> WARN_ON_ONCE() to catch FW problems if that suits you more.
If this would be an *error* why even add this check? We have tons of
code without doing sanity checks for firmware provided values - where
should we start or end?
So imho: either remove this check if this would be firmware error,
unless there is a good reason do keep this check, or if this is not an
error convert to WARN_ON_ONCE() and limit the copy_to_user().
Powered by blists - more mailing lists