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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
 <DM6PR04MB65754C0FF7EA562C33BCB0FBFCC22@DM6PR04MB6575.namprd04.prod.outlook.com>
Date: Fri, 14 Jun 2024 06:27:44 +0000
From: Avri Altman <Avri.Altman@....com>
To: Joel Slebodnick <jslebodn@...hat.com>, "linux-scsi@...r.kernel.org"
	<linux-scsi@...r.kernel.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"alim.akhtar@...sung.com" <alim.akhtar@...sung.com>, "bvanassche@....org"
	<bvanassche@....org>, "James.Bottomley@...senPartnership.com"
	<James.Bottomley@...senPartnership.com>, "martin.petersen@...cle.com"
	<martin.petersen@...cle.com>, "peter.wang@...iatek.com"
	<peter.wang@...iatek.com>, "manivannan.sadhasivam@...aro.org"
	<manivannan.sadhasivam@...aro.org>, "ahalaney@...hat.com"
	<ahalaney@...hat.com>, "beanhuo@...ron.com" <beanhuo@...ron.com>,
	"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH] scsi: ufs: core: Free memory allocated for model before
 reinit

> Under the conditions that a device is to be reinitialized within ufshcd_probe_hba,
> the device must first be fully reset.
> 
> Resetting the device should include freeing U8 model (member of
> dev_info)  but does not, and this causes a memory leak.
> ufs_put_device_desc is responsible for freeing model.
> 
> unreferenced object 0xffff3f63008bee60 (size 32):
>   comm "kworker/u33:1", pid 60, jiffies 4294892642
>   hex dump (first 32 bytes):
>     54 48 47 4a 46 47 54 30 54 32 35 42 41 5a 5a 41  THGJFGT0T25BAZZA
>     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>   backtrace (crc ed7ff1a9):
>     [<ffffb86705f1243c>] kmemleak_alloc+0x34/0x40
>     [<ffffb8670511cee4>] __kmalloc_noprof+0x1e4/0x2fc
>     [<ffffb86705c247fc>] ufshcd_read_string_desc+0x94/0x190
>     [<ffffb86705c26854>] ufshcd_device_init+0x480/0xdf8
>     [<ffffb86705c27b68>] ufshcd_probe_hba+0x3c/0x404
>     [<ffffb86705c29264>] ufshcd_async_scan+0x40/0x370
>     [<ffffb86704f43e9c>] async_run_entry_fn+0x34/0xe0
>     [<ffffb86704f34638>] process_one_work+0x154/0x298
>     [<ffffb86704f34a74>] worker_thread+0x2f8/0x408
>     [<ffffb86704f3cfa4>] kthread+0x114/0x118
>     [<ffffb86704e955a0>] ret_from_fork+0x10/0x20
> 
> Fixes: 96a7141da332 ("scsi: ufs: core: Add support for reinitializing the UFS
> device")
> Cc: <stable@...r.kernel.org>
> 
> Reviewed-by: Andrew Halaney <ahalaney@...hat.com>
> Reviewed-by: Bart Van Assche <bvanassche@....org>
> Signed-off-by: Joel Slebodnick <jslebodn@...hat.com>
Reviewed-by: Avri Altman <avri.altman@....com>


> ---
>  drivers/ufs/core/ufshcd.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index
> 0cf07194bbe8..a0407b9213ca 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8787,6 +8787,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba, bool
> init_dev_params)
>             (hba->quirks & UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH)) {
>                 /* Reset the device and controller before doing reinit */
>                 ufshcd_device_reset(hba);
> +               ufs_put_device_desc(hba);
>                 ufshcd_hba_stop(hba);
>                 ufshcd_vops_reinit_notify(hba);
>                 ret = ufshcd_hba_enable(hba);
> --
> 2.40.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ