public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: core: Correct wrong kfree() usage for `kobj->name`
@ 2026-01-16  8:13 Tzung-Bi Shih
  2026-01-16  9:00 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Tzung-Bi Shih @ 2026-01-16  8:13 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, tzungbi, stable

`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@vger.kernel.org
Fixes: b49493f99690 ("Fix a memory leak in scsi_host_dev_release()")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-17 19:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-16  8:13 [PATCH] scsi: core: Correct wrong kfree() usage for `kobj->name` Tzung-Bi Shih
2026-01-16  9:00 ` Greg KH
2026-01-16  9:37   ` Tzung-Bi Shih
2026-01-16 10:50     ` Greg KH
2026-01-17 19:48       ` Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox