brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 18 Jul 2016 23:24:34 +0000 (16:24 -0700)
committerKalle Valo <kvalo@codeaurora.org>
Tue, 19 Jul 2016 18:14:19 +0000 (21:14 +0300)
In case brcmf_sdiod_recv_chain() cannot complete a succeful call to
brcmf_sdiod_buffrw, we would be leaking glom_skb and not free it as we
should, fix this.

Reported-by: coverity (CID 1164856)
Fixes: a413e39a38573 ("brcmfmac: fix brcmf_sdcard_recv_chain() for host without sg support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c

index c4b89d27e2e8940466b209b15dcacb6574a50f5e..f549c25608d6f8e1750693aaaa790e57cd003683 100644 (file)
@@ -726,8 +726,10 @@ int brcmf_sdiod_recv_chain(struct brcmf_sdio_dev *sdiodev,
                        return -ENOMEM;
                err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
                                         glom_skb);
-               if (err)
+               if (err) {
+                       brcmu_pkt_buf_free_skb(glom_skb);
                        goto done;
+               }
 
                skb_queue_walk(pktq, skb) {
                        memcpy(skb->data, glom_skb->data, skb->len);