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: <ZvEkwqxArMQij8VG@kuha.fi.intel.com>
Date: Mon, 23 Sep 2024 11:20:18 +0300
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Dipendra Khadka <kdipendra88@...il.com>
Cc: gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Fix  dereferencing freed memory 'fw'

Hi Dipendra,

Thanks for the patch. You forgot the susbsytem and driver from your
subject line:
https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format

On Sun, Sep 22, 2024 at 10:52:11AM +0000, Dipendra Khadka wrote:
> smatch reported dereferencing freed memory as below:
> '''
> drivers/usb/typec/tipd/core.c:1196 tps6598x_apply_patch() error: dereferencing freed memory 'fw'
> '''
> 
> Invoking release_firware(fw) just after checking ret.
> 
> Signed-off-by: Dipendra Khadka <kdipendra88@...il.com>

This is a use-after-free case, so please add the Fixes tag:

Fixes: 916b8e5fa73d ("usb: typec: tipd: add error log to provide firmware name and size")

> ---
>  drivers/usb/typec/tipd/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c
> index ea768b19a7f1..eb5596e3406a 100644
> --- a/drivers/usb/typec/tipd/core.c
> +++ b/drivers/usb/typec/tipd/core.c
> @@ -1191,11 +1191,11 @@ static int tps6598x_apply_patch(struct tps6598x *tps)
>  	dev_info(tps->dev, "Firmware update succeeded\n");
>  
>  release_fw:
> -	release_firmware(fw);
>  	if (ret) {
>  		dev_err(tps->dev, "Failed to write patch %s of %zu bytes\n",
>  			firmware_name, fw->size);
>  	}
> +	release_firmware(fw);
>  
>  	return ret;
>  };
> -- 
> 2.43.0

thanks,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ