diff mbox series

[1/5,v2] wifi: mwifiex: fix memory leak in mwifiex_histogram_read()

Message ID 20230728084407.101930-1-dmantipov@yandex.ru
State Superseded
Headers show
Series [1/5,v2] wifi: mwifiex: fix memory leak in mwifiex_histogram_read() | expand

Commit Message

Dmitry Antipov July 28, 2023, 8:43 a.m. UTC
Always free the zeroed page on return from 'mwifiex_histogram_read()'.

Fixes: cbf6e05527a7 ("mwifiex: add rx histogram statistics support")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
---
v2: adjust to match series
---
 drivers/net/wireless/marvell/mwifiex/debugfs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Kalle Valo July 31, 2023, 9:46 a.m. UTC | #1
Dmitry Antipov <dmantipov@yandex.ru> writes:

> v2: adjust to match series

I don't know what that means. Please try to be specific in the changelog
entries. Also it might be easier for you if you include a cover letter
and place the changelog there.
Antipov, Dmitriy July 31, 2023, 9:55 a.m. UTC | #2
On Mon, 2023-07-31 at 12:46 +0300, Kalle Valo wrote:

> > v2: adjust to match series
> 
> I don't know what that means. Please try to be specific in the
> changelog entries.

Usually it means that if something is changed in the middle of the
series, surrounding patches are slightly tweaked to ensure that
everything still applies clearly (i.e. without offsets). If there
is something more substantial, I'm doing my best to explicitly
mention it.

Dmitry
diff mbox series

Patch

diff --git a/drivers/net/wireless/marvell/mwifiex/debugfs.c b/drivers/net/wireless/marvell/mwifiex/debugfs.c
index 52b18f4a774b..0cdd6c50c1c0 100644
--- a/drivers/net/wireless/marvell/mwifiex/debugfs.c
+++ b/drivers/net/wireless/marvell/mwifiex/debugfs.c
@@ -253,8 +253,11 @@  mwifiex_histogram_read(struct file *file, char __user *ubuf,
 	if (!p)
 		return -ENOMEM;
 
-	if (!priv || !priv->hist_data)
-		return -EFAULT;
+	if (!priv || !priv->hist_data) {
+		ret = -EFAULT;
+		goto free_and_exit;
+	}
+
 	phist_data = priv->hist_data;
 
 	p += sprintf(p, "\n"
@@ -309,6 +312,8 @@  mwifiex_histogram_read(struct file *file, char __user *ubuf,
 	ret = simple_read_from_buffer(ubuf, count, ppos, (char *)page,
 				      (unsigned long)p - page);
 
+free_and_exit:
+	free_page(page);
 	return ret;
 }