nouveau.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [Nouveau] [PATCH] Revert "drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()"
@ 2022-01-28 19:29 Lyude Paul
  2022-01-28 19:59 ` Lyude Paul
  0 siblings, 1 reply; 3+ messages in thread
From: Lyude Paul @ 2022-01-28 19:29 UTC (permalink / raw)
  To: nouveau
  Cc: David Airlie, Greg KH, open list, dri-devel, Ben Skeggs,
	Daniel Vetter, Zhou Qingyang

This reverts commit 2343bcdb4747d4f418a4daf2e898b94f86c24a59.

Unfortunately, as Greg pointed out I totally missed the fact that this
patch came from a umn.edu patch. umn.edu is still banned from contributing
to the Linux kernel, so let's revert this for the time being. I'll
re-evaluate this fix myself later and send another fix if this ends up
being valid.

Signed-off-by: Lyude Paul <lyude@redhat.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
---
 drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
index a6ea89a5d51a..667fa016496e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
@@ -142,12 +142,11 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char *name, int ver,
 
 	hsfw->imem_size = desc->code_size;
 	hsfw->imem_tag = desc->start_tag;
-	hsfw->imem = kmemdup(data + desc->code_off, desc->code_size, GFP_KERNEL);
+	hsfw->imem = kmalloc(desc->code_size, GFP_KERNEL);
+	memcpy(hsfw->imem, data + desc->code_off, desc->code_size);
+
 	nvkm_firmware_put(fw);
-	if (!hsfw->imem)
-		return -ENOMEM;
-	else
-		return 0;
+	return 0;
 }
 
 int
-- 
2.34.1


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

* Re: [Nouveau] [PATCH] Revert "drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()"
  2022-01-28 19:29 [Nouveau] [PATCH] Revert "drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()" Lyude Paul
@ 2022-01-28 19:59 ` Lyude Paul
  2022-01-29  8:33   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Lyude Paul @ 2022-01-28 19:59 UTC (permalink / raw)
  To: nouveau
  Cc: David Airlie, Greg KH, open list, dri-devel, Ben Skeggs,
	Daniel Vetter, Zhou Qingyang

on further reconsideration: Self-NAKing this. I don't see any issues with
those patches.

On Fri, 2022-01-28 at 14:29 -0500, Lyude Paul wrote:
> This reverts commit 2343bcdb4747d4f418a4daf2e898b94f86c24a59.
> 
> Unfortunately, as Greg pointed out I totally missed the fact that this
> patch came from a umn.edu patch. umn.edu is still banned from contributing
> to the Linux kernel, so let's revert this for the time being. I'll
> re-evaluate this fix myself later and send another fix if this ends up
> being valid.
> 
> Signed-off-by: Lyude Paul <lyude@redhat.com>
> Cc: Greg KH <gregkh@linuxfoundation.org>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: Karol Herbst <kherbst@redhat.com>
> ---
>  drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
> b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
> index a6ea89a5d51a..667fa016496e 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c
> @@ -142,12 +142,11 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char
> *name, int ver,
>  
>         hsfw->imem_size = desc->code_size;
>         hsfw->imem_tag = desc->start_tag;
> -       hsfw->imem = kmemdup(data + desc->code_off, desc->code_size,
> GFP_KERNEL);
> +       hsfw->imem = kmalloc(desc->code_size, GFP_KERNEL);
> +       memcpy(hsfw->imem, data + desc->code_off, desc->code_size);
> +
>         nvkm_firmware_put(fw);
> -       if (!hsfw->imem)
> -               return -ENOMEM;
> -       else
> -               return 0;
> +       return 0;
>  }
>  
>  int

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat


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

* Re: [Nouveau] [PATCH] Revert "drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()"
  2022-01-28 19:59 ` Lyude Paul
@ 2022-01-29  8:33   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-01-29  8:33 UTC (permalink / raw)
  To: Lyude Paul
  Cc: David Airlie, nouveau, open list, dri-devel, Ben Skeggs,
	Daniel Vetter, Zhou Qingyang

On Fri, Jan 28, 2022 at 02:59:42PM -0500, Lyude Paul wrote:
> on further reconsideration: Self-NAKing this. I don't see any issues with
> those patches.

I agree, the original change looks correct here.  Thanks for the
re-review.

greg k-h

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

end of thread, other threads:[~2022-01-29  8:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-28 19:29 [Nouveau] [PATCH] Revert "drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()" Lyude Paul
2022-01-28 19:59 ` Lyude Paul
2022-01-29  8:33   ` Greg KH

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).