2018-07-24 13:29:06

by Gustavo A. R. Silva

[permalink] [raw]
Subject: [PATCH] drm/nouveau/secboot/acr: fix memory leak

In case memory resources for *bl_desc* were allocated, release
them before return.

Addresses-Coverity-ID: 1472021 ("Resource leak")
Fixes: 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
Signed-off-by: Gustavo A. R. Silva <[email protected]>
---
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
index d02e183..5c14d6a 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
@@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
bl = acr->hsbl_unload_blob;
} else {
nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
+ kfree(bl_desc);
return -EINVAL;
}

--
2.7.4



2018-08-02 19:53:35

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH] drm/nouveau/secboot/acr: fix memory leak

Hi all,

Friendly ping! Who can take this?

Thanks
--
Gustavo

On 07/24/2018 08:27 AM, Gustavo A. R. Silva wrote:
> In case memory resources for *bl_desc* were allocated, release
> them before return.
>
> Addresses-Coverity-ID: 1472021 ("Resource leak")
> Fixes: 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
> Signed-off-by: Gustavo A. R. Silva <[email protected]>
> ---
> drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
> index d02e183..5c14d6a 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
> @@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
> bl = acr->hsbl_unload_blob;
> } else {
> nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
> + kfree(bl_desc);
> return -EINVAL;
> }
>
>

2018-09-08 03:07:51

by John Hubbard

[permalink] [raw]
Subject: Re: [PATCH] drm/nouveau/secboot/acr: fix memory leak

On 8/2/18 12:51 PM, Gustavo A. R. Silva wrote:
> Hi all,
>
> Friendly ping! Who can take this?
>
> Thanks
> --
> Gustavo
>
> On 07/24/2018 08:27 AM, Gustavo A. R. Silva wrote:
>> In case memory resources for *bl_desc* were allocated, release
>> them before return.
>>
>> Addresses-Coverity-ID: 1472021 ("Resource leak")
>> Fixes: 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
>> Signed-off-by: Gustavo A. R. Silva <[email protected]>
>> ---
>> drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
>> index d02e183..5c14d6a 100644
>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
>> @@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
>> bl = acr->hsbl_unload_blob;
>> } else {
>> nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
>> + kfree(bl_desc);
>> return -EINVAL;
>> }
>>
>>

Hi Gustavo,

Seeing as how I've been working on this corner of Nouveau lately (don't ask, haha),
I reviewed and also tested this. It looks good, you can add:

Reviewed-by: John Hubbard <[email protected]>

thanks,
--
John Hubbard
NVIDIA

2018-09-13 21:35:27

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH] drm/nouveau/secboot/acr: fix memory leak

On Fri, Sep 7, 2018 at 8:02 PM, John Hubbard <[email protected]> wrote:
> On 8/2/18 12:51 PM, Gustavo A. R. Silva wrote:
>> Hi all,
>>
>> Friendly ping! Who can take this?
>>
>> Thanks
>> --
>> Gustavo
>>
>> On 07/24/2018 08:27 AM, Gustavo A. R. Silva wrote:
>>> In case memory resources for *bl_desc* were allocated, release
>>> them before return.
>>>
>>> Addresses-Coverity-ID: 1472021 ("Resource leak")
>>> Fixes: 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
>>> Signed-off-by: Gustavo A. R. Silva <[email protected]>
>>> ---
>>> drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
>>> index d02e183..5c14d6a 100644
>>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
>>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
>>> @@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
>>> bl = acr->hsbl_unload_blob;
>>> } else {
>>> nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
>>> + kfree(bl_desc);
>>> return -EINVAL;
>>> }
>>>
>>>
>
> Hi Gustavo,
>
> Seeing as how I've been working on this corner of Nouveau lately (don't ask, haha),
> I reviewed and also tested this. It looks good, you can add:
>
> Reviewed-by: John Hubbard <[email protected]>

Ben can you take this?

Reviewed-by: Kees Cook <[email protected]>

-Kees

--
Kees Cook
Pixel Security

2018-09-14 07:26:52

by Ben Skeggs

[permalink] [raw]
Subject: Re: [Nouveau] [PATCH] drm/nouveau/secboot/acr: fix memory leak

On Fri, 14 Sep 2018 at 07:35, Kees Cook <[email protected]> wrote:
>
> On Fri, Sep 7, 2018 at 8:02 PM, John Hubbard <[email protected]> wrote:
> > On 8/2/18 12:51 PM, Gustavo A. R. Silva wrote:
> >> Hi all,
> >>
> >> Friendly ping! Who can take this?
> >>
> >> Thanks
> >> --
> >> Gustavo
> >>
> >> On 07/24/2018 08:27 AM, Gustavo A. R. Silva wrote:
> >>> In case memory resources for *bl_desc* were allocated, release
> >>> them before return.
> >>>
> >>> Addresses-Coverity-ID: 1472021 ("Resource leak")
> >>> Fixes: 0d466901552a ("drm/nouveau/secboot/acr: Remove VLA usage")
> >>> Signed-off-by: Gustavo A. R. Silva <[email protected]>
> >>> ---
> >>> drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c | 1 +
> >>> 1 file changed, 1 insertion(+)
> >>>
> >>> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
> >>> index d02e183..5c14d6a 100644
> >>> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
> >>> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c
> >>> @@ -801,6 +801,7 @@ acr_r352_load(struct nvkm_acr *_acr, struct nvkm_falcon *falcon,
> >>> bl = acr->hsbl_unload_blob;
> >>> } else {
> >>> nvkm_error(_acr->subdev, "invalid secure boot blob!\n");
> >>> + kfree(bl_desc);
> >>> return -EINVAL;
> >>> }
> >>>
> >>>
> >
> > Hi Gustavo,
> >
> > Seeing as how I've been working on this corner of Nouveau lately (don't ask, haha),
> > I reviewed and also tested this. It looks good, you can add:
> >
> > Reviewed-by: John Hubbard <[email protected]>
>
> Ben can you take this?
>
> Reviewed-by: Kees Cook <[email protected]>
I've got it in my tree. Thanks!

>
> -Kees
>
> --
> Kees Cook
> Pixel Security
> _______________________________________________
> Nouveau mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/nouveau