[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260116081359.353256-1-tzungbi@kernel.org>
Date: Fri, 16 Jan 2026 08:13:59 +0000
From: Tzung-Bi Shih <tzungbi@...nel.org>
To: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Cc: linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
tzungbi@...nel.org,
stable@...r.kernel.org
Subject: [PATCH] scsi: core: Correct wrong kfree() usage for `kobj->name`
`kobj->name` should be freed by kfree_const()[1][2]. Correct it.
[1] https://elixir.bootlin.com/linux/v6.18/source/lib/kasprintf.c#L41
[2] https://elixir.bootlin.com/linux/v6.18/source/lib/kobject.c#L695
Cc: stable@...r.kernel.org
Fixes: b49493f99690 ("Fix a memory leak in scsi_host_dev_release()")
Signed-off-by: Tzung-Bi Shih <tzungbi@...nel.org>
---
drivers/scsi/hosts.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index e047747d4ecf..50ec782cf9f4 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -373,7 +373,7 @@ static void scsi_host_dev_release(struct device *dev)
* name as well as the proc dir structure are leaked.
*/
scsi_proc_hostdir_rm(shost->hostt);
- kfree(dev_name(&shost->shost_dev));
+ kfree_const(dev_name(&shost->shost_dev));
}
kfree(shost->shost_data);
--
2.52.0.457.g6b5491de43-goog
Powered by blists - more mailing lists