All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: brcm80211: fix missing checks for kmemdup
@ 2019-03-12  4:39 Kangjie Lu
  2019-03-15  9:50 ` Arend Van Spriel
  0 siblings, 1 reply; 5+ messages in thread
From: Kangjie Lu @ 2019-03-12  4:39 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Arend van Spriel, Franky Lin, Hante Meuleman,
	Chi-Hsien Lin, Wright Feng, Kalle Valo, David S. Miller,
	Rafał Miłecki, Stefan Wahren, Chung-Hsien Hsu,
	linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
	netdev, linux-kernel

In case kmemdup fails, the fix sets conn_info->req_ie_len to zero
to avoid buffer overflows.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index e92f6351bd22..5d9a3c35fef5 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5464,6 +5464,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
 		conn_info->req_ie =
 		    kmemdup(cfg->extra_buf, conn_info->req_ie_len,
 			    GFP_KERNEL);
+		if (!conn_info->req_ie)
+			conn_info->req_ie_len = 0;
 	} else {
 		conn_info->req_ie_len = 0;
 		conn_info->req_ie = NULL;
@@ -5480,6 +5482,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
 		conn_info->resp_ie =
 		    kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
 			    GFP_KERNEL);
+		if (!conn_info->resp_ie)
+			conn_info->req_ie_len = 0;
 	} else {
 		conn_info->resp_ie_len = 0;
 		conn_info->resp_ie = NULL;
-- 
2.17.1


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

* Re: [PATCH v2] net: brcm80211: fix missing checks for kmemdup
  2019-03-12  4:39 [PATCH v2] net: brcm80211: fix missing checks for kmemdup Kangjie Lu
@ 2019-03-15  9:50 ` Arend Van Spriel
  2019-03-15 17:04   ` [PATCH v3] brcmfmac: " Kangjie Lu
  0 siblings, 1 reply; 5+ messages in thread
From: Arend Van Spriel @ 2019-03-15  9:50 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Franky Lin, Hante Meuleman, Chi-Hsien Lin, Wright Feng,
	Kalle Valo, David S. Miller, Rafał Miłecki,
	Stefan Wahren, Chung-Hsien Hsu, linux-wireless,
	brcm80211-dev-list.pdl, brcm80211-dev-list, netdev, linux-kernel

On 3/12/2019 5:39 AM, Kangjie Lu wrote:
> In case kmemdup fails, the fix sets conn_info->req_ie_len to zero
> to avoid buffer overflows.

Hi Kangjie,

See comment below. Also for v3 change prefix 'net:brcm80211:' to 
'brcmfmac:' instead.

> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> index e92f6351bd22..5d9a3c35fef5 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
> @@ -5464,6 +5464,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
>   		conn_info->req_ie =
>   		    kmemdup(cfg->extra_buf, conn_info->req_ie_len,
>   			    GFP_KERNEL);
> +		if (!conn_info->req_ie)
> +			conn_info->req_ie_len = 0;

good.

>   	} else {
>   		conn_info->req_ie_len = 0;
>   		conn_info->req_ie = NULL;
> @@ -5480,6 +5482,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
>   		conn_info->resp_ie =
>   		    kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
>   			    GFP_KERNEL);
> +		if (!conn_info->resp_ie)
> +			conn_info->req_ie_len = 0;

bad! I think you took my comment too literal. Here it should set 
conn_info->resp_ie_len to zero.

Regards,
Arend

>   	} else {
>   		conn_info->resp_ie_len = 0;
>   		conn_info->resp_ie = NULL;
> 

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

* [PATCH v3] brcmfmac: fix missing checks for kmemdup
  2019-03-15  9:50 ` Arend Van Spriel
@ 2019-03-15 17:04   ` Kangjie Lu
  2019-03-15 22:46     ` Arend Van Spriel
  2019-04-04 10:13     ` Kalle Valo
  0 siblings, 2 replies; 5+ messages in thread
From: Kangjie Lu @ 2019-03-15 17:04 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Arend van Spriel, Franky Lin, Hante Meuleman,
	Chi-Hsien Lin, Wright Feng, Kalle Valo, David S. Miller,
	Rafał Miłecki, Stefan Wahren, Chung-Hsien Hsu,
	linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
	netdev, linux-kernel

In case kmemdup fails, the fix sets conn_info->req_ie_len and
conn_info->resp_ie_len to zero to avoid buffer overflows.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
index e92f6351bd22..8ee8af4e7ec4 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
@@ -5464,6 +5464,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
 		conn_info->req_ie =
 		    kmemdup(cfg->extra_buf, conn_info->req_ie_len,
 			    GFP_KERNEL);
+		if (!conn_info->req_ie)
+			conn_info->req_ie_len = 0;
 	} else {
 		conn_info->req_ie_len = 0;
 		conn_info->req_ie = NULL;
@@ -5480,6 +5482,8 @@ static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_info *cfg,
 		conn_info->resp_ie =
 		    kmemdup(cfg->extra_buf, conn_info->resp_ie_len,
 			    GFP_KERNEL);
+		if (!conn_info->resp_ie)
+			conn_info->resp_ie_len = 0;
 	} else {
 		conn_info->resp_ie_len = 0;
 		conn_info->resp_ie = NULL;
-- 
2.17.1


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

* Re: [PATCH v3] brcmfmac: fix missing checks for kmemdup
  2019-03-15 17:04   ` [PATCH v3] brcmfmac: " Kangjie Lu
@ 2019-03-15 22:46     ` Arend Van Spriel
  2019-04-04 10:13     ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Arend Van Spriel @ 2019-03-15 22:46 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Franky Lin, Hante Meuleman, Chi-Hsien Lin, Wright Feng,
	Kalle Valo, David S. Miller, Rafał Miłecki,
	Stefan Wahren, Chung-Hsien Hsu, linux-wireless,
	brcm80211-dev-list.pdl, brcm80211-dev-list, netdev, linux-kernel

On 3/15/2019 6:04 PM, Kangjie Lu wrote:
> In case kmemdup fails, the fix sets conn_info->req_ie_len and
> conn_info->resp_ie_len to zero to avoid buffer overflows.

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 4 ++++
>   1 file changed, 4 insertions(+)

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

* Re: [PATCH v3] brcmfmac: fix missing checks for kmemdup
  2019-03-15 17:04   ` [PATCH v3] brcmfmac: " Kangjie Lu
  2019-03-15 22:46     ` Arend Van Spriel
@ 2019-04-04 10:13     ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2019-04-04 10:13 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: kjlu, pakki001, Arend van Spriel, Franky Lin, Hante Meuleman,
	Chi-Hsien Lin, Wright Feng, David S. Miller,
	Rafał Miłecki, Stefan Wahren, Chung-Hsien Hsu,
	linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
	netdev, linux-kernel

Kangjie Lu <kjlu@umn.edu> wrote:

> In case kmemdup fails, the fix sets conn_info->req_ie_len and
> conn_info->resp_ie_len to zero to avoid buffer overflows.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>

Patch applied to wireless-drivers-next.git, thanks.

46953f97224d brcmfmac: fix missing checks for kmemdup

-- 
https://patchwork.kernel.org/patch/10855341/

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


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

end of thread, other threads:[~2019-04-04 10:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  4:39 [PATCH v2] net: brcm80211: fix missing checks for kmemdup Kangjie Lu
2019-03-15  9:50 ` Arend Van Spriel
2019-03-15 17:04   ` [PATCH v3] brcmfmac: " Kangjie Lu
2019-03-15 22:46     ` Arend Van Spriel
2019-04-04 10:13     ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.