lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z+GPDvA8PM7DJ9ex@lstrano-desk.jf.intel.com>
Date: Mon, 24 Mar 2025 09:57:50 -0700
From: Matthew Brost <matthew.brost@...el.com>
To: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
CC: Lucas De Marchi <lucas.demarchi@...el.com>, Thomas
 Hellström <thomas.hellstrom@...ux.intel.com>, Rodrigo Vivi
	<rodrigo.vivi@...el.com>, David Airlie <airlied@...il.com>, Simona Vetter
	<simona@...ll.ch>, <intel-xe@...ts.freedesktop.org>,
	<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
	<dan.carpenter@...aro.org>, <kernel-janitors@...r.kernel.org>,
	<error27@...il.com>
Subject: Re: [PATCH] drm/xe/svm: fix dereferencing error pointer in
 drm_gpusvm_range_alloc()

On Sun, Mar 23, 2025 at 05:49:06AM -0700, Harshit Mogalapalli wrote:
> xe_svm_range_alloc() returns ERR_PTR(-ENOMEM) on failure and there is a
> dereference of "range" after that:
> 
> 	-->     range->gpusvm = gpusvm;
> 
> In xe_svm_range_alloc(), when memory allocation fails return NULL
> instead to handle this situation.
> 
> Fixes: 99624bdff867 ("drm/gpusvm: Add support for GPU Shared Virtual Memory")
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/all/adaef4dd-5866-48ca-bc22-4a1ddef20381@stanley.mountain/
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>

Reviewed-by: Matthew Brost <matthew.brost@...el.com>

> ---
> This is based on static analysis and only compile tested.
> ---
>  drivers/gpu/drm/xe/xe_svm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_svm.c b/drivers/gpu/drm/xe/xe_svm.c
> index 52e04e7e343f..a79df8cf1f36 100644
> --- a/drivers/gpu/drm/xe/xe_svm.c
> +++ b/drivers/gpu/drm/xe/xe_svm.c
> @@ -80,7 +80,7 @@ xe_svm_range_alloc(struct drm_gpusvm *gpusvm)
>  
>  	range = kzalloc(sizeof(*range), GFP_KERNEL);
>  	if (!range)
> -		return ERR_PTR(-ENOMEM);
> +		return NULL;
>  
>  	INIT_LIST_HEAD(&range->garbage_collector_link);
>  	xe_vm_get(gpusvm_to_vm(gpusvm));
> -- 
> 2.39.3
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ