dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drm/vmwgfx: Fix an uninitialized fence handle value
@ 2019-01-31  9:52 Thomas Hellstrom
  2019-02-01  2:07 ` Deepak Singh Rawat
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Hellstrom @ 2019-01-31  9:52 UTC (permalink / raw)
  To: dri-devel, linux-graphics-maintainer, drawat; +Cc: Thomas Hellstrom

if vmw_execbuf_fence_commands() fails, The handle value will be
uninitialized and a bogus fence handle might be copied to user-space.

Fixes: 2724b2d54cda: ("drm/vmwgfx: Use new validation interface for the modesetting code v2")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com> #v1
Reviewed-by: Sinclair Yeh <syeh@vmware.com> #v1
---
v2: Also initialize the ret local variable, to silence compilatior warnings.
Call vmw_execbuf_copy_fence_user regardless of the value of ret, to propagate
the correct error code to user-space.
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index b351fb5214d3..5e257a600cea 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -2554,8 +2554,8 @@ void vmw_kms_helper_validation_finish(struct vmw_private *dev_priv,
 				      user_fence_rep)
 {
 	struct vmw_fence_obj *fence = NULL;
-	uint32_t handle;
-	int ret;
+	uint32_t handle = 0;
+	int ret = 0;
 
 	if (file_priv || user_fence_rep || vmw_validation_has_bos(ctx) ||
 	    out_fence)
-- 
2.19.0.rc1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH v2] drm/vmwgfx: Fix an uninitialized fence handle value
  2019-01-31  9:52 [PATCH v2] drm/vmwgfx: Fix an uninitialized fence handle value Thomas Hellstrom
@ 2019-02-01  2:07 ` Deepak Singh Rawat
  0 siblings, 0 replies; 2+ messages in thread
From: Deepak Singh Rawat @ 2019-02-01  2:07 UTC (permalink / raw)
  To: Thomas Hellstrom, dri-devel, linux-graphics-maintainer

Reviewed-by: Deepak Rawat <drawat@vmware.com>

On Thu, 2019-01-31 at 10:52 +0100, Thomas Hellstrom wrote:
> if vmw_execbuf_fence_commands() fails, The handle value will be
> uninitialized and a bogus fence handle might be copied to user-space.
> 
> Fixes: 2724b2d54cda: ("drm/vmwgfx: Use new validation interface for
> the modesetting code v2")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Reviewed-by: Brian Paul <brianp@vmware.com> #v1
> Reviewed-by: Sinclair Yeh <syeh@vmware.com> #v1
> ---
> v2: Also initialize the ret local variable, to silence compilatior
> warnings.
> Call vmw_execbuf_copy_fence_user regardless of the value of ret, to
> propagate
> the correct error code to user-space.
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index b351fb5214d3..5e257a600cea 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -2554,8 +2554,8 @@ void vmw_kms_helper_validation_finish(struct
> vmw_private *dev_priv,
>  				      user_fence_rep)
>  {
>  	struct vmw_fence_obj *fence = NULL;
> -	uint32_t handle;
> -	int ret;
> +	uint32_t handle = 0;
> +	int ret = 0;
>  
>  	if (file_priv || user_fence_rep || vmw_validation_has_bos(ctx)
> ||
>  	    out_fence)

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2019-02-01  2:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-31  9:52 [PATCH v2] drm/vmwgfx: Fix an uninitialized fence handle value Thomas Hellstrom
2019-02-01  2:07 ` Deepak Singh Rawat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox