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: <5df2f9bb-9181-56da-ea85-06af7ea8704a@suse.de>
Date:   Thu, 10 Feb 2022 19:55:49 +0100
From:   Thomas Zimmermann <tzimmermann@...e.de>
To:     trix@...hat.com, airlied@...hat.com, airlied@...ux.ie,
        daniel@...ll.ch, nathan@...nel.org, ndesaulniers@...gle.com,
        maxime@...no.tech
Cc:     llvm@...ts.linux.dev, linux-kernel@...r.kernel.org,
        dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] drm/ast: fix using freed memory

Hi

Am 03.02.22 um 16:23 schrieb trix@...hat.com:
> From: Tom Rix <trix@...hat.com>
> 
> clang static analysis reports this problem
> ast_mode.c:1235:3: warning: Use of memory after it is freed
>    drm_connector_update_edid_property(&ast_connector->base, edid);
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> The second condition on
> 
>    if (!flags && ast_connector->i2c)
> 
> Means that the edid is not always set.  If the previous block
> fails the freed edid value will be used.  So set edid to NULL
> after freeing.

Thanks for your patch. We have meanwhile merges a change that replaces 
the code entirely.

Best regards
Thomas

> 
> Fixes: 55dc449a7c60 ("drm/ast: Handle failed I2C initialization gracefully")
> Signed-off-by: Tom Rix <trix@...hat.com>
> ---
>   drivers/gpu/drm/ast/ast_mode.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c
> index ab52efb15670e..9131dc8a1a2fc 100644
> --- a/drivers/gpu/drm/ast/ast_mode.c
> +++ b/drivers/gpu/drm/ast/ast_mode.c
> @@ -1224,10 +1224,12 @@ static int ast_get_modes(struct drm_connector *connector)
>   			return -ENOMEM;
>   
>   		flags = ast_dp501_read_edid(connector->dev, (u8 *)edid);
> -		if (flags)
> +		if (flags) {
>   			ast->dp501_maxclk = ast_get_dp501_max_clk(connector->dev);
> -		else
> +		} else {
>   			kfree(edid);
> +			edid = NULL;
> +		}
>   	}
>   	if (!flags && ast_connector->i2c)
>   		edid = drm_get_edid(connector, &ast_connector->i2c->adapter);

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ