]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
brcmsmac: Free packet if dma_mapping_error() fails in dma_rxfill
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 18 Jul 2016 23:24:35 +0000 (16:24 -0700)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 20 Oct 2016 13:07:22 +0000 (08:07 -0500)
BugLink: http://bugs.launchpad.net/bugs/1631468
commit 5c5fa1f464ac954982df1d96b9f9a5103d21aedd upstream.

In case dma_mapping_error() returns an error in dma_rxfill, we would be
leaking a packet that we allocated with brcmu_pkt_buf_get_skb().

Reported-by: coverity (CID 1081819)
Fixes: 67d0cf50bd32 ("brcmsmac: Fix WARNING caused by lack of calls to dma_mapping_error()")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
drivers/net/wireless/brcm80211/brcmsmac/dma.c

index 796f5f9d5d5a45bc621b0fd7e880a112aee1067a..b7df576bb84d9bfe5f4134bad4323ab48b8c9ed8 100644 (file)
@@ -1079,8 +1079,10 @@ bool dma_rxfill(struct dma_pub *pub)
 
                pa = dma_map_single(di->dmadev, p->data, di->rxbufsize,
                                    DMA_FROM_DEVICE);
-               if (dma_mapping_error(di->dmadev, pa))
+               if (dma_mapping_error(di->dmadev, pa)) {
+                       brcmu_pkt_buf_free_skb(p);
                        return false;
+               }
 
                /* save the free packet pointer */
                di->rxp[rxout] = p;