patch "uio_hv_generic: Fix a memory leak in error handling paths" added to char-misc-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
uio_hv_generic: Fix a memory leak in error handling paths
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 3ee098f96b8b6c1a98f7f97915f8873164e6af9d Mon Sep 17 00:00:00 2001
From: Christophe JAILLET <[email protected]>
Date: Sun, 9 May 2021 09:13:03 +0200
Subject: uio_hv_generic: Fix a memory leak in error handling paths
If 'vmbus_establish_gpadl()' fails, the (recv|send)_gpadl will not be updated and 'hv_uio_cleanup()' in the error handling path will not be able to free the corresponding buffer.
In such a case, we need to free the buffer explicitly.
--- drivers/uio/uio_hv_generic.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/uio/uio_hv_generic.c +6 -2
@@ -296,8 +296,10 @@ hv_uio_probe(struct hv_device *dev, ret =vmbus_establish_gpadl (channel, pdata->recv_buf,RECV_BUFFER_SIZE , &pdata->recv_gpadl); -if (ret) +if (ret) { +vfree (pdata->recv_buf); goto fail_close; + }/* put Global Physical Address Label in name */ snprintf(pdata->recv_name, sizeof(pdata->recv_name),
@@ -316,8 +318,10 @@ hv_uio_probe(struct hv_device *dev, ret =vmbus_establish_gpadl (channel, pdata->send_buf,SEND_BUFFER_SIZE , &pdata->send_gpadl); -if (ret) +if (ret) { +vfree (pdata->send_buf); goto fail_close; + }snprintf (pdata->send_name,sizeof (pdata->send_name),"send:%u" , pdata->send_gpadl);
Signature · 1 line
2.31.1