All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
@ 2021-12-13 18:31 ` Roberto Sassu
  0 siblings, 0 replies; 7+ messages in thread
From: Roberto Sassu @ 2021-12-13 18:31 UTC (permalink / raw)
  To: airlied, kraxel, daniel
  Cc: dri-devel, virtualization, linux-kernel, Roberto Sassu, stable,
	syzbot+e9072e90624a31dfa85f

If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
called with objs equal to NULL.

Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
return from the function.

Cc: stable@vger.kernel.org # 5.13.x
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock virtio_gpu_object_array")
---
 drivers/gpu/drm/virtio/virtgpu_gem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index 2de61b63ef91..48d3c9955f0d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -248,6 +248,9 @@ void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs)
 {
 	u32 i;
 
+	if (!objs)
+		return;
+
 	for (i = 0; i < objs->nents; i++)
 		drm_gem_object_put(objs->objs[i]);
 	virtio_gpu_array_free(objs);
-- 
2.32.0


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

* [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
@ 2021-12-13 18:31 ` Roberto Sassu
  0 siblings, 0 replies; 7+ messages in thread
From: Roberto Sassu @ 2021-12-13 18:31 UTC (permalink / raw)
  To: airlied, kraxel, daniel
  Cc: syzbot+e9072e90624a31dfa85f, Roberto Sassu, linux-kernel, stable,
	virtualization, dri-devel

If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
called with objs equal to NULL.

Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
return from the function.

Cc: stable@vger.kernel.org # 5.13.x
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock virtio_gpu_object_array")
---
 drivers/gpu/drm/virtio/virtgpu_gem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c
index 2de61b63ef91..48d3c9955f0d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_gem.c
+++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
@@ -248,6 +248,9 @@ void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs)
 {
 	u32 i;
 
+	if (!objs)
+		return;
+
 	for (i = 0; i < objs->nents; i++)
 		drm_gem_object_put(objs->objs[i]);
 	virtio_gpu_array_free(objs);
-- 
2.32.0


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

* RE: [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
  2021-12-13 18:31 ` Roberto Sassu
@ 2021-12-16 15:12   ` Roberto Sassu
  -1 siblings, 0 replies; 7+ messages in thread
From: Roberto Sassu @ 2021-12-16 15:12 UTC (permalink / raw)
  To: airlied, kraxel, daniel
  Cc: dri-devel, virtualization, linux-kernel, stable,
	syzbot+e9072e90624a31dfa85f

> From: Roberto Sassu
> Sent: Monday, December 13, 2021 7:31 PM
> If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
> happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
> called with objs equal to NULL.
> 
> Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
> return from the function.

Hello

did you have the chance to look at this patch?

Thanks

Roberto

HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063
Managing Director: Li Peng, Zhong Ronghua

> Cc: stable@vger.kernel.org # 5.13.x
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
> Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock
> virtio_gpu_object_array")
> ---
>  drivers/gpu/drm/virtio/virtgpu_gem.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c
> b/drivers/gpu/drm/virtio/virtgpu_gem.c
> index 2de61b63ef91..48d3c9955f0d 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_gem.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
> @@ -248,6 +248,9 @@ void virtio_gpu_array_put_free(struct
> virtio_gpu_object_array *objs)
>  {
>  	u32 i;
> 
> +	if (!objs)
> +		return;
> +
>  	for (i = 0; i < objs->nents; i++)
>  		drm_gem_object_put(objs->objs[i]);
>  	virtio_gpu_array_free(objs);
> --
> 2.32.0


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

* RE: [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
@ 2021-12-16 15:12   ` Roberto Sassu
  0 siblings, 0 replies; 7+ messages in thread
From: Roberto Sassu @ 2021-12-16 15:12 UTC (permalink / raw)
  To: airlied, kraxel, daniel
  Cc: stable, syzbot+e9072e90624a31dfa85f, linux-kernel, dri-devel,
	virtualization

> From: Roberto Sassu
> Sent: Monday, December 13, 2021 7:31 PM
> If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
> happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
> called with objs equal to NULL.
> 
> Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
> return from the function.

Hello

did you have the chance to look at this patch?

Thanks

Roberto

HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063
Managing Director: Li Peng, Zhong Ronghua

> Cc: stable@vger.kernel.org # 5.13.x
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
> Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock
> virtio_gpu_object_array")
> ---
>  drivers/gpu/drm/virtio/virtgpu_gem.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c
> b/drivers/gpu/drm/virtio/virtgpu_gem.c
> index 2de61b63ef91..48d3c9955f0d 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_gem.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c
> @@ -248,6 +248,9 @@ void virtio_gpu_array_put_free(struct
> virtio_gpu_object_array *objs)
>  {
>  	u32 i;
> 
> +	if (!objs)
> +		return;
> +
>  	for (i = 0; i < objs->nents; i++)
>  		drm_gem_object_put(objs->objs[i]);
>  	virtio_gpu_array_free(objs);
> --
> 2.32.0


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

* Re: [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
  2021-12-13 18:31 ` Roberto Sassu
  (?)
@ 2022-01-18  6:56   ` Gerd Hoffmann
  -1 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2022-01-18  6:56 UTC (permalink / raw)
  To: Roberto Sassu
  Cc: airlied, daniel, dri-devel, virtualization, linux-kernel, stable,
	syzbot+e9072e90624a31dfa85f

On Mon, Dec 13, 2021 at 07:31:22PM +0100, Roberto Sassu wrote:
> If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
> happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
> called with objs equal to NULL.
> 
> Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
> return from the function.
> 
> Cc: stable@vger.kernel.org # 5.13.x
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
> Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock virtio_gpu_object_array")

Pushed to drm-misc-next.

thanks,
  Gerd


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

* Re: [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
@ 2022-01-18  6:56   ` Gerd Hoffmann
  0 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2022-01-18  6:56 UTC (permalink / raw)
  To: Roberto Sassu
  Cc: syzbot+e9072e90624a31dfa85f, airlied, linux-kernel, stable,
	virtualization, dri-devel, daniel

On Mon, Dec 13, 2021 at 07:31:22PM +0100, Roberto Sassu wrote:
> If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
> happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
> called with objs equal to NULL.
> 
> Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
> return from the function.
> 
> Cc: stable@vger.kernel.org # 5.13.x
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
> Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock virtio_gpu_object_array")

Pushed to drm-misc-next.

thanks,
  Gerd

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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

* Re: [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
@ 2022-01-18  6:56   ` Gerd Hoffmann
  0 siblings, 0 replies; 7+ messages in thread
From: Gerd Hoffmann @ 2022-01-18  6:56 UTC (permalink / raw)
  To: Roberto Sassu
  Cc: syzbot+e9072e90624a31dfa85f, airlied, linux-kernel, stable,
	virtualization, dri-devel

On Mon, Dec 13, 2021 at 07:31:22PM +0100, Roberto Sassu wrote:
> If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
> happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
> called with objs equal to NULL.
> 
> Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
> return from the function.
> 
> Cc: stable@vger.kernel.org # 5.13.x
> Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
> Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock virtio_gpu_object_array")

Pushed to drm-misc-next.

thanks,
  Gerd


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

end of thread, other threads:[~2022-01-18  6:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 18:31 [PATCH] drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free() Roberto Sassu
2021-12-13 18:31 ` Roberto Sassu
2021-12-16 15:12 ` Roberto Sassu
2021-12-16 15:12   ` Roberto Sassu
2022-01-18  6:56 ` Gerd Hoffmann
2022-01-18  6:56   ` Gerd Hoffmann
2022-01-18  6:56   ` Gerd Hoffmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.