Skip to content

Commit

Permalink
wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
Browse files Browse the repository at this point in the history
[ Upstream commit 9c8fd72 ]

Always free the zeroed page on return from 'mwifiex_histogram_read()'.

Fixes: cbf6e05 ("mwifiex: add rx histogram statistics support")

Acked-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802160726.85545-1-dmantipov@yandex.ru
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
dmantipov authored and gregkh committed Sep 13, 2023
1 parent 9257a1d commit 84081b4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/net/wireless/marvell/mwifiex/debugfs.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 84081b4

Please sign in to comment.