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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210115201819.GA8375@amd>
Date:   Fri, 15 Jan 2021 21:18:19 +0100
From:   Pavel Machek <pavel@....cz>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Xiaolei Wang <xiaolei.wang@...driver.com>,
        Mark Brown <broonie@...nel.org>
Subject: Re: [PATCH 5.10 086/103] regmap: debugfs: Fix a memory leak when
 calling regmap_attach_dev

Hi!

> From: Xiaolei Wang <xiaolei.wang@...driver.com>
> 
> commit cffa4b2122f5f3e53cf3d529bbc74651f95856d5 upstream.
> 
> After initializing the regmap through
> syscon_regmap_lookup_by_compatible, then regmap_attach_dev to the
> device, because the debugfs_name has been allocated, there is no
> need to redistribute it again

? redistribute?

Anyway, this patch is clearly buggy:

>  
>  	if (!strcmp(name, "dummy")) {
> -		kfree(map->debugfs_name);
> +		if (!map->debugfs_name)
> +			kfree(map->debugfs_name);
>  

It runs kfree only if the variable is NULL. That's clearly useless,
kfree(NULL) is NOP, and this causes memory leak.

Best regards,
								Pavel
-- 
http://www.livejournal.com/~pavelmachek

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ