brcmfmac: To fix kernel crash on out of boundary access
authorRaveendran Somu <raveendran.somu@cypress.com>
Thu, 4 Jun 2020 07:18:31 +0000 (02:18 -0500)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 14 Jul 2020 09:43:41 +0000 (12:43 +0300)
To truncate the additional bytes, if extra bytes have been received.
Current code only have a warning and proceed without handling it.
But in one of the crash reported by DVT, these causes the
crash intermittently. So the processing is limit to the skb->len.

Signed-off-by: Raveendran Somu <raveendran.somu@cypress.com>
Signed-off-by: Chi-hsien Lin <chi-hsien.lin@cypress.com>
Signed-off-by: Wright Feng <wright.feng@cypress.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20200604071835.3842-2-wright.feng@cypress.com
drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c

index 09701262330d6d6c580aaf0126e31b9935ba5c27..531fe9be4025298271cd63a84668bead921a82f0 100644 (file)
@@ -1843,6 +1843,9 @@ void brcmf_fws_hdrpull(struct brcmf_if *ifp, s16 siglen, struct sk_buff *skb)
 
        WARN_ON(siglen > skb->len);
 
+       if (siglen > skb->len)
+               siglen = skb->len;
+
        if (!siglen)
                return;
        /* if flow control disabled, skip to packet data and leave */