mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xen/scsiback: fix potential memory leak in scsiback_remove()
@ 2025-12-23  6:30 Abdun Nihaal
  2026-01-05 12:31 ` Jürgen Groß
  2026-01-12  3:15 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Abdun Nihaal @ 2025-12-23  6:30 UTC (permalink / raw)
  To: jgross
  Cc: Abdun Nihaal, sstabellini, oleksandr_tyshchenko, linux-scsi,
	linux-kernel, stable

Memory allocated for struct vscsiblk_info in scsiback_probe() is not
freed in scsiback_remove() leading to potential memory leaks on remove,
as well as in the scsiback_probe() error paths. Fix that by freeing it
in scsiback_remove().

Cc: stable@vger.kernel.org
Fixes: d9d660f6e562 ("xen-scsiback: Add Xen PV SCSI backend driver")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
---
Compile tested only. Issue found using static analysis.

 drivers/xen/xen-scsiback.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 0c51edfd13dc..7d5117e5efe0 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -1262,6 +1262,7 @@ static void scsiback_remove(struct xenbus_device *dev)
 	gnttab_page_cache_shrink(&info->free_pages, 0);
 
 	dev_set_drvdata(&dev->dev, NULL);
+	kfree(info);
 }
 
 static int scsiback_probe(struct xenbus_device *dev,
-- 
2.43.0


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

* Re: [PATCH] xen/scsiback: fix potential memory leak in scsiback_remove()
  2025-12-23  6:30 [PATCH] xen/scsiback: fix potential memory leak in scsiback_remove() Abdun Nihaal
@ 2026-01-05 12:31 ` Jürgen Groß
  2026-01-12  3:15 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Jürgen Groß @ 2026-01-05 12:31 UTC (permalink / raw)
  To: Abdun Nihaal
  Cc: sstabellini, oleksandr_tyshchenko, linux-scsi, linux-kernel, stable


[-- Attachment #1.1.1: Type: text/plain, Size: 508 bytes --]

On 23.12.25 07:30, Abdun Nihaal wrote:
> Memory allocated for struct vscsiblk_info in scsiback_probe() is not
> freed in scsiback_remove() leading to potential memory leaks on remove,
> as well as in the scsiback_probe() error paths. Fix that by freeing it
> in scsiback_remove().
> 
> Cc: stable@vger.kernel.org
> Fixes: d9d660f6e562 ("xen-scsiback: Add Xen PV SCSI backend driver")
> Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3743 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

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

* Re: [PATCH] xen/scsiback: fix potential memory leak in scsiback_remove()
  2025-12-23  6:30 [PATCH] xen/scsiback: fix potential memory leak in scsiback_remove() Abdun Nihaal
  2026-01-05 12:31 ` Jürgen Groß
@ 2026-01-12  3:15 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2026-01-12  3:15 UTC (permalink / raw)
  To: jgross, Abdun Nihaal
  Cc: Martin K . Petersen, sstabellini, oleksandr_tyshchenko,
	linux-scsi, linux-kernel, stable

On Tue, 23 Dec 2025 12:00:11 +0530, Abdun Nihaal wrote:

> Memory allocated for struct vscsiblk_info in scsiback_probe() is not
> freed in scsiback_remove() leading to potential memory leaks on remove,
> as well as in the scsiback_probe() error paths. Fix that by freeing it
> in scsiback_remove().
> 
> 

Applied to 6.19/scsi-fixes, thanks!

[1/1] xen/scsiback: fix potential memory leak in scsiback_remove()
      https://git.kernel.org/mkp/scsi/c/901a5f309dab

-- 
Martin K. Petersen

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

end of thread, other threads:[~2026-01-12  3:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-23  6:30 [PATCH] xen/scsiback: fix potential memory leak in scsiback_remove() Abdun Nihaal
2026-01-05 12:31 ` Jürgen Groß
2026-01-12  3:15 ` Martin K. Petersen

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

all inboxes | Powered by JetHome®