linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hostap: Fix memleak in prism2_config
@ 2021-03-29  8:52 Dinghao Liu
  2021-04-07 11:53 ` Kalle Valo
  2021-04-18  6:14 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: Dinghao Liu @ 2021-03-29  8:52 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Jouni Malinen, Kalle Valo, David S. Miller, Jakub Kicinski,
	Leon Romanovsky, linux-wireless, netdev, linux-kernel

When prism2_hw_config() fails, we just return an error code
without any resource release, which may lead to memleak.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 drivers/net/wireless/intersil/hostap/hostap_cs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intersil/hostap/hostap_cs.c b/drivers/net/wireless/intersil/hostap/hostap_cs.c
index ec7db2badc40..7dc16ab50ad6 100644
--- a/drivers/net/wireless/intersil/hostap/hostap_cs.c
+++ b/drivers/net/wireless/intersil/hostap/hostap_cs.c
@@ -536,10 +536,10 @@ static int prism2_config(struct pcmcia_device *link)
 	sandisk_enable_wireless(dev);
 
 	ret = prism2_hw_config(dev, 1);
-	if (!ret)
-		ret = hostap_hw_ready(dev);
+	if (ret)
+		goto failed;
 
-	return ret;
+	return hostap_hw_ready(dev);;
 
  failed:
 	kfree(hw_priv);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hostap: Fix memleak in prism2_config
  2021-03-29  8:52 [PATCH] hostap: Fix memleak in prism2_config Dinghao Liu
@ 2021-04-07 11:53 ` Kalle Valo
  2021-04-18  6:14 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-04-07 11:53 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Jouni Malinen, David S. Miller, Jakub Kicinski,
	Leon Romanovsky, linux-wireless, netdev, linux-kernel

Dinghao Liu <dinghao.liu@zju.edu.cn> writes:

> When prism2_hw_config() fails, we just return an error code
> without any resource release, which may lead to memleak.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/net/wireless/intersil/hostap/hostap_cs.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/intersil/hostap/hostap_cs.c b/drivers/net/wireless/intersil/hostap/hostap_cs.c
> index ec7db2badc40..7dc16ab50ad6 100644
> --- a/drivers/net/wireless/intersil/hostap/hostap_cs.c
> +++ b/drivers/net/wireless/intersil/hostap/hostap_cs.c
> @@ -536,10 +536,10 @@ static int prism2_config(struct pcmcia_device *link)
>  	sandisk_enable_wireless(dev);
>  
>  	ret = prism2_hw_config(dev, 1);
> -	if (!ret)
> -		ret = hostap_hw_ready(dev);
> +	if (ret)
> +		goto failed;
>  
> -	return ret;
> +	return hostap_hw_ready(dev);;

Two semicolons.

But I'm not sure about this, can someone provide a Reviewed-by tag?

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hostap: Fix memleak in prism2_config
  2021-03-29  8:52 [PATCH] hostap: Fix memleak in prism2_config Dinghao Liu
  2021-04-07 11:53 ` Kalle Valo
@ 2021-04-18  6:14 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-04-18  6:14 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: dinghao.liu, kjlu, Jouni Malinen, David S. Miller,
	Jakub Kicinski, Leon Romanovsky, linux-wireless, netdev,
	linux-kernel

Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:

> When prism2_hw_config() fails, we just return an error code
> without any resource release, which may lead to memleak.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>

Nobody reviewed this, so dropping the patch.

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20210329085246.24586-1-dinghao.liu@zju.edu.cn/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-18  6:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29  8:52 [PATCH] hostap: Fix memleak in prism2_config Dinghao Liu
2021-04-07 11:53 ` Kalle Valo
2021-04-18  6: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).