Re: [PATCH] gpio: prevent potential speculation leaks in gpio_device_get_desc()

From: Hagar Hemdan
Date: Fri May 17 2024 - 04:01:54 EST


On Fri, May 17, 2024 at 12:22:39AM +0800, Kent Gibson wrote:
> On Thu, May 16, 2024 at 10:55:40PM +0800, Kent Gibson wrote:
> > On Thu, May 16, 2024 at 12:57:42PM +0000, Hagar Hemdan wrote:
> > > On Tue, May 14, 2024 at 08:42:21PM +0800, Kent Gibson wrote:
> >
> > Now I need to test your patch to see what it actually does.
> >
>
> Tested. Fails. It does what I thought it would - clamps the offset into
> bounds BEFORE the call to gpio_device_get_desc().
>
> The appropriate place for this fix is in gpio_device_get_desc(), after
> the bounds check.
>
> Cheers,
> Kent.
>
yes, you are right. The speculation macro should be after the bounds
check. I missed this property this time.
I will fix it in v2.

Thanks,
Hagar Hemdan