* [PATCH] wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout
@ 2018-06-28 13:08 Gustavo A. R. Silva
2018-07-02 11:30 ` Tony Lindgren
2018-07-04 15:14 ` Kalle Valo
0 siblings, 2 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-06-28 13:08 UTC (permalink / raw)
To: Tony Lindgren, Kalle Valo, David S. Miller
Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva
In case memory resources for *events_vector* were allocated, release
them before return.
Addresses-Coverity-ID: 1470194 ("Resource leak")
Fixes: 4ec7cece87b3 ("wlcore: Add missing PM call for wlcore_cmd_wait_for_event_or_timeout()")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/net/wireless/ti/wlcore/cmd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
index 836c616..9039687 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.c
+++ b/drivers/net/wireless/ti/wlcore/cmd.c
@@ -195,8 +195,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
ret = pm_runtime_get_sync(wl->dev);
if (ret < 0) {
pm_runtime_put_noidle(wl->dev);
-
- return ret;
+ goto free_vector;
}
do {
@@ -232,6 +231,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
out:
pm_runtime_mark_last_busy(wl->dev);
pm_runtime_put_autosuspend(wl->dev);
+free_vector:
kfree(events_vector);
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout
2018-06-28 13:08 [PATCH] wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout Gustavo A. R. Silva
@ 2018-07-02 11:30 ` Tony Lindgren
2018-07-02 13:01 ` Gustavo A. R. Silva
2018-07-04 15:14 ` Kalle Valo
1 sibling, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2018-07-02 11:30 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Kalle Valo, David S. Miller, linux-wireless, netdev, linux-kernel
* Gustavo A. R. Silva <gustavo@embeddedor.com> [180628 13:11]:
> In case memory resources for *events_vector* were allocated, release
> them before return.
>
> Addresses-Coverity-ID: 1470194 ("Resource leak")
> Fixes: 4ec7cece87b3 ("wlcore: Add missing PM call for wlcore_cmd_wait_for_event_or_timeout()")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Thanks for catching this one:
Acked-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/net/wireless/ti/wlcore/cmd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
> index 836c616..9039687 100644
> --- a/drivers/net/wireless/ti/wlcore/cmd.c
> +++ b/drivers/net/wireless/ti/wlcore/cmd.c
> @@ -195,8 +195,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
> ret = pm_runtime_get_sync(wl->dev);
> if (ret < 0) {
> pm_runtime_put_noidle(wl->dev);
> -
> - return ret;
> + goto free_vector;
> }
>
> do {
> @@ -232,6 +231,7 @@ int wlcore_cmd_wait_for_event_or_timeout(struct wl1271 *wl,
> out:
> pm_runtime_mark_last_busy(wl->dev);
> pm_runtime_put_autosuspend(wl->dev);
> +free_vector:
> kfree(events_vector);
> return ret;
> }
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout
2018-07-02 11:30 ` Tony Lindgren
@ 2018-07-02 13:01 ` Gustavo A. R. Silva
0 siblings, 0 replies; 4+ messages in thread
From: Gustavo A. R. Silva @ 2018-07-02 13:01 UTC (permalink / raw)
To: Tony Lindgren
Cc: Kalle Valo, David S. Miller, linux-wireless, netdev, linux-kernel
On 07/02/2018 06:30 AM, Tony Lindgren wrote:
> * Gustavo A. R. Silva <gustavo@embeddedor.com> [180628 13:11]:
>> In case memory resources for *events_vector* were allocated, release
>> them before return.
>>
>> Addresses-Coverity-ID: 1470194 ("Resource leak")
>> Fixes: 4ec7cece87b3 ("wlcore: Add missing PM call for wlcore_cmd_wait_for_event_or_timeout()")
>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>
> Thanks for catching this one:
>
> Acked-by: Tony Lindgren <tony@atomide.com>
>
Glad to help. :)
Thanks
--
Gustavo
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout
2018-06-28 13:08 [PATCH] wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout Gustavo A. R. Silva
2018-07-02 11:30 ` Tony Lindgren
@ 2018-07-04 15:14 ` Kalle Valo
1 sibling, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2018-07-04 15:14 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Tony Lindgren, David S. Miller, linux-wireless, netdev,
linux-kernel, Gustavo A. R. Silva
"Gustavo A. R. Silva" <gustavo@embeddedor.com> wrote:
> In case memory resources for *events_vector* were allocated, release
> them before return.
>
> Addresses-Coverity-ID: 1470194 ("Resource leak")
> Fixes: 4ec7cece87b3 ("wlcore: Add missing PM call for wlcore_cmd_wait_for_event_or_timeout()")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> Acked-by: Tony Lindgren <tony@atomide.com>
Patch applied to wireless-drivers-next.git, thanks.
04614fe46f31 wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout
--
https://patchwork.kernel.org/patch/10493849/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-07-04 15:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28 13:08 [PATCH] wlcore: Fix memory leak in wlcore_cmd_wait_for_event_or_timeout Gustavo A. R. Silva
2018-07-02 11:30 ` Tony Lindgren
2018-07-02 13:01 ` Gustavo A. R. Silva
2018-07-04 15:14 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).