wifi: mwifiex: fix memory leak in mwifiex_histogram_read()
[ Upstream commit 9c8fd72a5c2a031cbc680a2990107ecd958ffcdb ]
Always free the zeroed page on return from 'mwifiex_histogram_read()'.
Fixes: cbf6e05527
("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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
0fe11dd3fe
commit
0c4240d23d
@@ -265,8 +265,11 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf,
|
|||||||
if (!p)
|
if (!p)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
if (!priv || !priv->hist_data)
|
if (!priv || !priv->hist_data) {
|
||||||
return -EFAULT;
|
ret = -EFAULT;
|
||||||
|
goto free_and_exit;
|
||||||
|
}
|
||||||
|
|
||||||
phist_data = priv->hist_data;
|
phist_data = priv->hist_data;
|
||||||
|
|
||||||
p += sprintf(p, "\n"
|
p += sprintf(p, "\n"
|
||||||
@@ -321,6 +324,8 @@ mwifiex_histogram_read(struct file *file, char __user *ubuf,
|
|||||||
ret = simple_read_from_buffer(ubuf, count, ppos, (char *)page,
|
ret = simple_read_from_buffer(ubuf, count, ppos, (char *)page,
|
||||||
(unsigned long)p - page);
|
(unsigned long)p - page);
|
||||||
|
|
||||||
|
free_and_exit:
|
||||||
|
free_page(page);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user