linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 1/3] brcmfmac: Avoid possible out-of-bounds read
@ 2017-09-09 19:30 Kevin Cernekee
  2017-09-09 19:30 ` [PATCH V2 2/3] brcmfmac: Delete redundant length check Kevin Cernekee
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Kevin Cernekee @ 2017-09-09 19:30 UTC (permalink / raw)
  To: arend.vanspriel, franky.lin
  Cc: brcm80211-dev-list.pdl, linux-wireless, mnissler

In brcmf_p2p_notify_rx_mgmt_p2p_probereq(), chanspec is assigned before
the length of rxframe is validated.  This could lead to uninitialized
data being accessed (but not printed).  Since we already have a
perfectly good endian-swapped copy of rxframe->chanspec in ch.chspec,
and ch.chspec is not modified by decchspec(), avoid the extra
assignment and use ch.chspec in the debug print.

Suggested-by: Mattias Nissler <mnissler@chromium.org>
Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
Reviewed-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


V1->V2: Clarify changelog re: whether the uninitialized data is printed.


diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
index 2ce675ab40ef..1c450c0727cb 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
@@ -1853,7 +1853,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
 	struct afx_hdl *afx_hdl = &p2p->afx_hdl;
 	struct brcmf_cfg80211_vif *vif = ifp->vif;
 	struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data;
-	u16 chanspec = be16_to_cpu(rxframe->chanspec);
 	struct brcmu_chan ch;
 	u8 *mgmt_frame;
 	u32 mgmt_frame_len;
@@ -1906,7 +1905,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp,
 	cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, 0);
 
 	brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n",
-		  mgmt_frame_len, e->datalen, chanspec, freq);
+		  mgmt_frame_len, e->datalen, ch.chspec, freq);
 
 	return 0;
 }
-- 
2.14.1.581.gf28d330327-goog

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

end of thread, other threads:[~2017-09-13  4:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-09 19:30 [PATCH V2 1/3] brcmfmac: Avoid possible out-of-bounds read Kevin Cernekee
2017-09-09 19:30 ` [PATCH V2 2/3] brcmfmac: Delete redundant length check Kevin Cernekee
2017-09-09 19:30 ` [PATCH V2 3/3] brcmfmac: Add check for short event packets Kevin Cernekee
2017-09-12  7:45   ` [V2,3/3] " Kalle Valo
2017-09-10 18:50 ` [PATCH V2 1/3] brcmfmac: Avoid possible out-of-bounds read Arend van Spriel
2017-09-12  5:48   ` Kalle Valo
2017-09-12  7:36     ` Arend van Spriel
2017-09-12  7:47       ` Kalle Valo
2017-09-12  7:59         ` Arend van Spriel
2017-09-12  8:05           ` Kalle Valo
2017-09-12  8:18             ` Arend van Spriel
2017-09-12 12:33               ` Greg KH
2017-09-13  4:20                 ` 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).