Commit 9c8fd72a authored by Dmitry Antipov's avatar Dmitry Antipov Committed by Kalle Valo

wifi: mwifiex: fix memory leak in mwifiex_histogram_read()

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

Fixes: cbf6e055 ("mwifiex: add rx histogram statistics support")
Acked-by: default avatarBrian Norris <briannorris@chromium.org>
Signed-off-by: default avatarDmitry Antipov <dmantipov@yandex.ru>
Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230802160726.85545-1-dmantipov@yandex.ru
parent cb39c357
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment