aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Antipov <[email protected]>2023-08-02 19:07:15 +0300
committerKalle Valo <[email protected]>2023-08-21 18:56:26 +0300
commit9c8fd72a5c2a031cbc680a2990107ecd958ffcdb (patch)
tree4fe86611dadc1fa61f4549c9d05aa74a0b81728c
parentcb39c35783f26892bb1a72b1115c94fa2e77f4c5 (diff)
wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
Always free the zeroed page on return from 'mwifiex_histogram_read()'. Fixes: cbf6e05527a7 ("mwifiex: add rx histogram statistics support") Acked-by: Brian Norris <[email protected]> Signed-off-by: Dmitry Antipov <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--drivers/net/wireless/marvell/mwifiex/debugfs.c9
1 files changed, 7 insertions, 2 deletions
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;
}