linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] nl80211: don't return err unconditionally in nl80211_start_ap()
@ 2020-06-26  9:49 Luca Coelho
  2020-06-26  9:49 ` [PATCH 2/2] nl80211: fix memory leak when parsing NL80211_ATTR_HE_BSS_COLOR Luca Coelho
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Coelho @ 2020-06-26  9:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

From: Luca Coelho <luciano.coelho@intel.com>

When a memory leak was fixed, a return err was changed to goto err,
but, accidentally, the if (err) was removed, so now we always exit at
this point.

Fix it by adding if (err) back.

Fixes: 9951ebfcdf2b ("nl80211: fix potential leak in AP start")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/wireless/nl80211.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 263ae395ad44..f31698fd4a7e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5016,7 +5016,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 		err = nl80211_parse_he_obss_pd(
 					info->attrs[NL80211_ATTR_HE_OBSS_PD],
 					&params.he_obss_pd);
-		goto out;
+		if (err)
+			goto out;
 	}
 
 	if (info->attrs[NL80211_ATTR_HE_BSS_COLOR]) {
-- 
2.27.0


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

* [PATCH 2/2] nl80211: fix memory leak when parsing NL80211_ATTR_HE_BSS_COLOR
  2020-06-26  9:49 [PATCH 1/2] nl80211: don't return err unconditionally in nl80211_start_ap() Luca Coelho
@ 2020-06-26  9:49 ` Luca Coelho
  2020-06-26 10:44   ` John Crispin
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Coelho @ 2020-06-26  9:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

From: Luca Coelho <luciano.coelho@intel.com>

If there is an error when parsing the NL80211_ATTR_HE_BSS_COLOR
attribute, we return immediately without freeing param.acl.  Fit it by
using goto out instead of returning immediately.

Fixes: 5c5e52d1bb96 ("nl80211: add handling for BSS color")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f31698fd4a7e..0e07fb8585fb 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -5025,7 +5025,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
 					info->attrs[NL80211_ATTR_HE_BSS_COLOR],
 					&params.he_bss_color);
 		if (err)
-			return err;
+			goto out;
 	}
 
 	nl80211_calculate_ap_params(&params);
-- 
2.27.0


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

* Re: [PATCH 2/2] nl80211: fix memory leak when parsing NL80211_ATTR_HE_BSS_COLOR
  2020-06-26  9:49 ` [PATCH 2/2] nl80211: fix memory leak when parsing NL80211_ATTR_HE_BSS_COLOR Luca Coelho
@ 2020-06-26 10:44   ` John Crispin
  0 siblings, 0 replies; 3+ messages in thread
From: John Crispin @ 2020-06-26 10:44 UTC (permalink / raw)
  To: Luca Coelho, johannes; +Cc: linux-wireless


On 26.06.20 11:49, Luca Coelho wrote:
> From: Luca Coelho <luciano.coelho@intel.com>
>
> If there is an error when parsing the NL80211_ATTR_HE_BSS_COLOR
> attribute, we return immediately without freeing param.acl.  Fit it by
> using goto out instead of returning immediately.
>
> Fixes: 5c5e52d1bb96 ("nl80211: add handling for BSS color")
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

Acked-by: John Crispin <john@phrozen.org>

Thanks !

> ---
>   net/wireless/nl80211.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
> index f31698fd4a7e..0e07fb8585fb 100644
> --- a/net/wireless/nl80211.c
> +++ b/net/wireless/nl80211.c
> @@ -5025,7 +5025,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
>   					info->attrs[NL80211_ATTR_HE_BSS_COLOR],
>   					&params.he_bss_color);
>   		if (err)
> -			return err;
> +			goto out;
>   	}
>   
>   	nl80211_calculate_ap_params(&params);

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

end of thread, other threads:[~2020-06-26 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26  9:49 [PATCH 1/2] nl80211: don't return err unconditionally in nl80211_start_ap() Luca Coelho
2020-06-26  9:49 ` [PATCH 2/2] nl80211: fix memory leak when parsing NL80211_ATTR_HE_BSS_COLOR Luca Coelho
2020-06-26 10:44   ` John Crispin

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