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,
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
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
linux-stable-mirror@lists.linaro.org