[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250811053708.145381-1-shivani.agarwal@broadcom.com>
Date: Sun, 10 Aug 2025 22:37:08 -0700
From: Shivani Agarwal <shivani.agarwal@...adcom.com>
To: stable@...r.kernel.org,
gregkh@...uxfoundation.org
Cc: bcm-kernel-feedback-list@...adcom.com,
linux-kernel@...r.kernel.org,
ajay.kaher@...adcom.com,
alexey.makhalov@...adcom.com,
tapas.kundu@...adcom.com,
kys@...rosoft.com,
haiyangz@...rosoft.com,
wei.liu@...nel.org,
decui@...rosoft.com,
stephen@...workplumber.org,
linux-hyperv@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Shivani Agarwal <shivani.agarwal@...adcom.com>
Subject: [PATCH] uio_hv_generic: Fix another memory leak in error handling paths
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
commit 0b0226be3a52dadd965644bc52a807961c2c26df upstream.
Memory allocated by 'vmbus_alloc_ring()' at the beginning of the probe
function is never freed in the error handling path.
Add the missing 'vmbus_free_ring()' call.
Note that it is already freed in the .remove function.
Fixes: cdfa835c6e5e ("uio_hv_generic: defer opening vmbus until first use")
Cc: stable <stable@...r.kernel.org>
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Link: https://lore.kernel.org/r/0d86027b8eeed8e6360bc3d52bcdb328ff9bdca1.1620544055.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
[Shivani: Modified to apply on 5.10.y]
Signed-off-by: Shivani Agarwal <shivani.agarwal@...adcom.com>
---
drivers/uio/uio_hv_generic.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c
index 6625d340f..865a5b289 100644
--- a/drivers/uio/uio_hv_generic.c
+++ b/drivers/uio/uio_hv_generic.c
@@ -306,7 +306,7 @@ hv_uio_probe(struct hv_device *dev,
pdata->recv_buf = vzalloc(RECV_BUFFER_SIZE);
if (pdata->recv_buf == NULL) {
ret = -ENOMEM;
- goto fail_close;
+ goto fail_free_ring;
}
ret = vmbus_establish_gpadl(channel, pdata->recv_buf,
@@ -366,6 +366,8 @@ hv_uio_probe(struct hv_device *dev,
fail_close:
hv_uio_cleanup(dev, pdata);
+fail_free_ring:
+ vmbus_free_ring(dev->channel);
return ret;
}
Powered by blists - more mailing lists