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]
Date: Tue, 2 Apr 2024 16:53:53 +0530
From: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
To: Boris Brezillon <boris.brezillon@...labora.com>,
        Steven Price <steven.price@....com>, Liviu Dudau <liviu.dudau@....com>,
        Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
        Maxime Ripard <mripard@...nel.org>,
        Thomas Zimmermann <tzimmermann@...e.de>,
        David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>,
        Heiko Stuebner <heiko@...ech.de>, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org
Cc: dan.carpenter@...aro.org, kernel-janitors@...r.kernel.org,
        error27@...il.com
Subject: Re: [PATCH] drm/panthor: Fix IS_ERR() vs NULL bug in
 group_process_tiler_oom()

Hi,

On 02/04/24 16:47, Harshit Mogalapalli wrote:
> panthor_vm_get_heap_pool() returns ERR_PTR on failure, update the check
> accordingly.
> 
> Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@...cle.com>
> ---
> This is based on static analysis with smatch, only compile tested.
> ---
>   drivers/gpu/drm/panthor/panthor_sched.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c
> index 5f7803b6fc48..d34f213795a3 100644
> --- a/drivers/gpu/drm/panthor/panthor_sched.c
> +++ b/drivers/gpu/drm/panthor/panthor_sched.c
> @@ -1343,7 +1343,10 @@ static int group_process_tiler_oom(struct panthor_group *group, u32 cs_id)
>   	if (unlikely(csg_id < 0))
>   		return 0;
>   
> -	if (!heaps || frag_end > vt_end || vt_end >= vt_start) {
> +	if (IS_ERR(heaps))
> +		return PTR_ERR(heaps);
> +

Please ignore this patch, doesn't look correct on looking at more closely.

I should have just done this:

diff --git a/drivers/gpu/drm/panthor/panthor_sched.c 
b/drivers/gpu/drm/panthor/panthor_sched.c
index 5f7803b6fc48..617df2b980d0 100644
--- a/drivers/gpu/drm/panthor/panthor_sched.c
+++ b/drivers/gpu/drm/panthor/panthor_sched.c
@@ -1343,7 +1343,7 @@ static int group_process_tiler_oom(struct 
panthor_group *group, u32 cs_id)
         if (unlikely(csg_id < 0))
                 return 0;

-       if (!heaps || frag_end > vt_end || vt_end >= vt_start) {
+       if (IS_ERR(heaps) || frag_end > vt_end || vt_end >= vt_start) {
                 ret = -EINVAL;
         } else {
                 /* We do the allocation without holding the scheduler 
lock to avoid


Thanks,
Harshit


> +	if (frag_end > vt_end || vt_end >= vt_start) {
>   		ret = -EINVAL;
>   	} else {
>   		/* We do the allocation without holding the scheduler lock to avoid


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ