Message ID | 20230726072114.51964-1-dmantipov@yandex.ru |
---|---|
State | Superseded |
Headers | show |
Series | [1/5] wifi: mwifiex: fix memory leak in mwifiex_histogram_read() | expand |
On Wed, 2023-07-26 at 12:24 -0700, Brian Norris wrote: > I had comments for patch 2. Patch 1, 3, 4, 5 look good: > > Acked-by: Brian Norris <briannorris@chromium.org> Should I add Acked-by: <you> to all of the above in case of resend without changes, or leave it to the maintainer? Dmitry
"Antipov, Dmitriy" <Dmitriy.Antipov@softline.com> writes: > On Wed, 2023-07-26 at 12:24 -0700, Brian Norris wrote: > > >> I had comments for patch 2. Patch 1, 3, 4, 5 look good: >> >> Acked-by: Brian Norris <briannorris@chromium.org> > > Should I add Acked-by: <you> to all of the above in case > of resend without changes, or leave it to the maintainer? Adding Brian's Acked-by to patches 1, 3, 4, 5 is a good idea as long as you don't change those patches. But no need to resend because of this.
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; }
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> --- NOTE: this series supersedes all of the previous mwifiex patches not yet accepted into wireless-next tree. --- drivers/net/wireless/marvell/mwifiex/debugfs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)