linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/secboot/acr: fix memory leak
@ 2018-07-24 13:27 Gustavo A. R. Silva
  2018-08-02 19:51 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-07-24 13:27 UTC (permalink / raw)
  To: Kees Cook, Ben Skeggs, David Airlie
  Cc: dri-devel, nouveau, linux-kernel, Gustavo A. R. Silva

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 <gustavo@embeddedor.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/nouveau/secboot/acr: fix memory leak
  2018-07-24 13:27 [PATCH] drm/nouveau/secboot/acr: fix memory leak Gustavo A. R. Silva
@ 2018-08-02 19:51 ` Gustavo A. R. Silva
  2018-09-08  3:02   ` John Hubbard
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2018-08-02 19:51 UTC (permalink / raw)
  To: Kees Cook, Ben Skeggs, David Airlie; +Cc: dri-devel, nouveau, linux-kernel

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 <gustavo@embeddedor.com>
> ---
>  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;
>  	}
>  
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/nouveau/secboot/acr: fix memory leak
  2018-08-02 19:51 ` Gustavo A. R. Silva
@ 2018-09-08  3:02   ` John Hubbard
  2018-09-13 21:35     ` Kees Cook
  0 siblings, 1 reply; 5+ messages in thread
From: John Hubbard @ 2018-09-08  3:02 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Kees Cook, Ben Skeggs, David Airlie
  Cc: dri-devel, nouveau, linux-kernel

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 <gustavo@embeddedor.com>
>> ---
>>  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 <jhubbard@nvidia.com>

thanks,
-- 
John Hubbard
NVIDIA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/nouveau/secboot/acr: fix memory leak
  2018-09-08  3:02   ` John Hubbard
@ 2018-09-13 21:35     ` Kees Cook
  2018-09-14  7:26       ` [Nouveau] " Ben Skeggs
  0 siblings, 1 reply; 5+ messages in thread
From: Kees Cook @ 2018-09-13 21:35 UTC (permalink / raw)
  To: Ben Skeggs
  Cc: John Hubbard, Gustavo A. R. Silva, David Airlie,
	Maling list - DRI developers, nouveau, LKML

On Fri, Sep 7, 2018 at 8:02 PM, John Hubbard <jhubbard@nvidia.com> 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 <gustavo@embeddedor.com>
>>> ---
>>>  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 <jhubbard@nvidia.com>

Ben can you take this?

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

-- 
Kees Cook
Pixel Security

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau/secboot/acr: fix memory leak
  2018-09-13 21:35     ` Kees Cook
@ 2018-09-14  7:26       ` Ben Skeggs
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Skeggs @ 2018-09-14  7:26 UTC (permalink / raw)
  To: keescook
  Cc: Ben Skeggs, Gustavo A. R. Silva, Dave Airlie, linux-kernel,
	dri-devel, nouveau

On Fri, 14 Sep 2018 at 07:35, Kees Cook <keescook@chromium.org> wrote:
>
> On Fri, Sep 7, 2018 at 8:02 PM, John Hubbard <jhubbard@nvidia.com> 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 <gustavo@embeddedor.com>
> >>> ---
> >>>  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 <jhubbard@nvidia.com>
>
> Ben can you take this?
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
I've got it in my tree.  Thanks!

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-09-14  7:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-24 13:27 [PATCH] drm/nouveau/secboot/acr: fix memory leak Gustavo A. R. Silva
2018-08-02 19:51 ` Gustavo A. R. Silva
2018-09-08  3:02   ` John Hubbard
2018-09-13 21:35     ` Kees Cook
2018-09-14  7:26       ` [Nouveau] " Ben Skeggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).