LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging: r8188eu: Fix a resource leak in update_bcn_wps_ie
@ 2021-08-21  8:18 Xiangyang Zhang
  2021-08-21  8:41 ` Michael Straube
  0 siblings, 1 reply; 2+ messages in thread
From: Xiangyang Zhang @ 2021-08-21  8:18 UTC (permalink / raw)
  To: gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel, xyz.sun.ok

The "pbackup_remainder_ie" variable is not freed when "pwps_ie_src" is null

Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
Signed-off-by: Xiangyang Zhang <xyz.sun.ok@gmail.com>
---
 drivers/staging/r8188eu/core/rtw_ap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
index 1127e9a52458..2ce982390c7b 100644
--- a/drivers/staging/r8188eu/core/rtw_ap.c
+++ b/drivers/staging/r8188eu/core/rtw_ap.c
@@ -1300,7 +1300,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
 
 	pwps_ie_src = pmlmepriv->wps_beacon_ie;
 	if (!pwps_ie_src)
-		return;
+		goto exit;
 
 	wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
 	if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) {
@@ -1314,6 +1314,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
 		pnetwork->IELength = wps_offset + (wps_ielen + 2) + remainder_ielen;
 	}
 
+exit:
 	kfree(pbackup_remainder_ie);
 }
 
-- 
2.19.1


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

* Re: [PATCH] staging: r8188eu: Fix a resource leak in update_bcn_wps_ie
  2021-08-21  8:18 [PATCH] staging: r8188eu: Fix a resource leak in update_bcn_wps_ie Xiangyang Zhang
@ 2021-08-21  8:41 ` Michael Straube
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Straube @ 2021-08-21  8:41 UTC (permalink / raw)
  To: Xiangyang Zhang, gregkh; +Cc: Larry.Finger, phil, linux-staging, linux-kernel

On 8/21/21 10:18 AM, Xiangyang Zhang wrote:
> The "pbackup_remainder_ie" variable is not freed when "pwps_ie_src" is null
> 
> Fixes: 15865124feed ("staging: r8188eu: introduce new core dir for RTL8188eu driver")
> Signed-off-by: Xiangyang Zhang <xyz.sun.ok@gmail.com>
> ---
>   drivers/staging/r8188eu/core/rtw_ap.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_ap.c b/drivers/staging/r8188eu/core/rtw_ap.c
> index 1127e9a52458..2ce982390c7b 100644
> --- a/drivers/staging/r8188eu/core/rtw_ap.c
> +++ b/drivers/staging/r8188eu/core/rtw_ap.c
> @@ -1300,7 +1300,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
>   
>   	pwps_ie_src = pmlmepriv->wps_beacon_ie;
>   	if (!pwps_ie_src)
> -		return;
> +		goto exit;
>   
>   	wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
>   	if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) {
> @@ -1314,6 +1314,7 @@ static void update_bcn_wps_ie(struct adapter *padapter)
>   		pnetwork->IELength = wps_offset + (wps_ielen + 2) + remainder_ielen;
>   	}
>   
> +exit:
>   	kfree(pbackup_remainder_ie);
>   }
>   
> 

Looks good to me.

Acked-by: Michael Straube <straube.linux@gmail.com>


Thanks,

Michael

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

end of thread, other threads:[~2021-08-21  8:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21  8:18 [PATCH] staging: r8188eu: Fix a resource leak in update_bcn_wps_ie Xiangyang Zhang
2021-08-21  8:41 ` Michael Straube

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).