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:   Wed, 26 May 2021 23:52:47 +0000
From:   "Chrisanthus, Anitha" <anitha.chrisanthus@...el.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        "Dea, Edmund J" <edmund.j.dea@...el.com>,
        "airlied@...ux.ie" <airlied@...ux.ie>,
        "daniel@...ll.ch" <daniel@...ll.ch>,
        "sam@...nborg.org" <sam@...nborg.org>
CC:     "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH] drm/kmb: Fix an error handling path

Hi Christophe,
Thanks for the patch, good catch! Patch looks good, few minor comments.

Anitha

> -----Original Message-----
> From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> Sent: Wednesday, May 19, 2021 1:47 PM
> To: Chrisanthus, Anitha <anitha.chrisanthus@...el.com>; Dea, Edmund J
> <edmund.j.dea@...el.com>; airlied@...ux.ie; daniel@...ll.ch;
> sam@...nborg.org
> Cc: dri-devel@...ts.freedesktop.org; linux-kernel@...r.kernel.org; kernel-
> janitors@...r.kernel.org; Christophe JAILLET <christophe.jaillet@...adoo.fr>
> Subject: [PATCH] drm/kmb: Fix an error handling path
> 
> If 'platform_get_irq()' fails, it is spurious to call
> 'of_reserved_mem_device_release()' in the error handling path, because
> 'of_reserved_mem_device_init() has not been called yet.
> 
> Moreover, a previous 'kmb_initialize_clocks()' is unbalanced by a
> corresponding 'kmb_display_clk_disable()' call, has already done in the
> remove function.
> 
> It is likely that 'kmb_display_clk_disable()' is expected in the error
> handling path, instead of 'kmb_display_clk_disable()'.
You mean instead of of_reserved_mem_device_release()
> 
> 
> Also, it is spurious to return directly if 'of_reserved_mem_device_init()'
> fails.
> Goto the error handling path instead to free some resources.
> 
> Fixes: 7f7b96a8a0a1 ("drm/kmb: Add support for KeemBay Display")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---
>  drivers/gpu/drm/kmb/kmb_drv.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/kmb/kmb_drv.c
> b/drivers/gpu/drm/kmb/kmb_drv.c
> index f64e06e1067d..b41b8789fe57 100644
> --- a/drivers/gpu/drm/kmb/kmb_drv.c
> +++ b/drivers/gpu/drm/kmb/kmb_drv.c
> @@ -138,13 +138,13 @@ static int kmb_hw_init(struct drm_device *drm,
> unsigned long flags)
>  	irq_lcd = platform_get_irq(pdev, 0);
>  	if (irq_lcd < 0) {
>  		drm_err(&kmb->drm, "irq_lcd not found");
> -		goto setup_fail;
> +		goto disable_clk_err;
Keep setup_fail label or something like err_free_clocks
>  	}
> 
>  	/* Get the optional framebuffer memory resource */
>  	ret = of_reserved_mem_device_init(drm->dev);
>  	if (ret && ret != -ENODEV)
> -		return ret;
> +		goto disable_clk_err;
> 
>  	spin_lock_init(&kmb->irq_lock);
> 
> @@ -152,8 +152,8 @@ static int kmb_hw_init(struct drm_device *drm,
> unsigned long flags)
> 
>  	return 0;
> 
> - setup_fail:
> -	of_reserved_mem_device_release(drm->dev);
> + disable_clk_err:
> +	kmb_display_clk_disable(kmb);
> 
>  	return ret;
>  }
> --
> 2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ