brcmfmac: fix txglomming scatter-gather packet transfers
Subsystems (3)
Quoted 8 lines · Linux Kernel
Commit: 1eb43018673e735ea9cd756970f4e71ca01a5f21 Parent: 21f8aaee0c62708654988ce092838aa7df4d25d8 Author: Arend van Spriel <[email protected]> AuthorDate: Thu Feb 20 18:55:55 2014 +0100 Committer: John W. Linville <[email protected]> CommitDate: Thu Feb 20 15:53:20 2014 -0500brcmfmac: fix txglomming scatter-gather packet transfers
Coverity just flagged this code.
Review
Quoted 6 lines
(quoted diff) +2
-0if (skb_tailroom(pkt) < tail_pad && pkt->len > blksize) { + pkt_pad = brcmu_pkt_buf_get_skb(tail_pad + tail_chop + + bus->head_align); if (pkt_pad == NULL) return -ENOMEM; ret = brcmf_sdio_txpkt_hdalign(bus, pkt_pad);
Right after this, I think we need the diff below or we leak pkt_pad. If this looks right, I'll submit it properly tomorrow.
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +3 -1
@@ -1948,8 +1948,10 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus,if (pkt_pad ==NULL )return -ENOMEM ; ret =brcmf_sdio_txpkt_hdalign (bus, pkt_pad); -if (unlikely (ret <0 )) +if (unlikely (ret <0 )) { +kfree_skb (pkt_pad);return ret; + }memcpy (pkt_pad->data, pkt->data + pkt->len - tail_chop, tail_chop);
Quoted 13 lines · Dave Jones
Quoted 8 lines · Linux Kernel
Commit: 1eb43018673e735ea9cd756970f4e71ca01a5f21 Parent: 21f8aaee0c62708654988ce092838aa7df4d25d8 Author: Arend van Spriel <[email protected]> AuthorDate: Thu Feb 20 18:55:55 2014 +0100 Committer: John W. Linville <[email protected]> CommitDate: Thu Feb 20 15:53:20 2014 -0500brcmfmac: fix txglomming scatter-gather packet transfers
Coverity just flagged this code.
Quoted 9 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus, · line 1950
Quoted 6 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +2
-0if (skb_tailroom (pkt) < tail_pad && pkt->len > blksize) { + pkt_pad =brcmu_pkt_buf_get_skb (tail_pad + tail_chop + + bus->head_align);if (pkt_pad ==NULL )return -ENOMEM ; ret =brcmf_sdio_txpkt_hdalign (bus, pkt_pad);Right after this, I think we need the diff below or we leak
pkt_pad. If this looks right, I'll submit it properly tomorrow.
Looks right to me so go ahead.
Regards,
Arend
Quoted 17 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +3
-1@@ -1948,8 +1948,10 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus,if (pkt_pad ==NULL )return -ENOMEM ; ret =brcmf_sdio_txpkt_hdalign (bus, pkt_pad); -if (unlikely (ret <0 )) +if (unlikely (ret <0 )) { +kfree_skb (pkt_pad);return ret; + }memcpy (pkt_pad->data, pkt->data + pkt->len - tail_chop, tail_chop);
brcmfmac: fix skb leak in brcmf_sdio_txpkt_prep_sg error path.
Commit 1eb4301867 added an allocation of an skb via brcmu_pkt_buf_get_skb() but forgot to free it on one of the error paths.
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +3 -1
@@ -1948,8 +1948,10 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus,if (pkt_pad ==NULL )return -ENOMEM ; ret =brcmf_sdio_txpkt_hdalign (bus, pkt_pad); -if (unlikely (ret <0 )) +if (unlikely (ret <0 )) { +kfree_skb (pkt_pad);return ret; + }memcpy (pkt_pad->data, pkt->data + pkt->len - tail_chop, tail_chop);
Re: brcmfmac: fix skb leak in brcmf_sdio_txpkt_prep_sg error path.
- netdev
+ linux-wireless
Quoted 3 lines · Dave Jones
Commit
1eb4301867added an allocation of an skb viabrcmu_pkt_buf_get_skb()but forgot to free it on one of the error paths.
- Cc: Arend van Spriel<[email protected]>
+ Acked-by: Arend van Spriel <[email protected]
Quoted 1 line
Signed-off-by Dave Jones<[email protected]>
---
I guess you intend John to take this patch, right?
Regards,
Arend
Quoted 18 lines
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +3
-1@@ -1948,8 +1948,10 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus,if (pkt_pad ==NULL )return -ENOMEM ; ret =brcmf_sdio_txpkt_hdalign (bus, pkt_pad); -if (unlikely (ret<0 )) +if (unlikely (ret<0 )) { +kfree_skb (pkt_pad);return ret; + }memcpy (pkt_pad->data, pkt->data + pkt->len - tail_chop, tail_chop);
Re: brcmfmac: fix skb leak in brcmf_sdio_txpkt_prep_sg error path.
In reply to Dave JonesHello.
Quoted 1 line · Dave Jones
Commit
1eb4301867added an allocation of an skb viabrcmu_pkt_buf_get_skb()
Please also specify that commit's summary line is parens.
Quoted 4 lines
but forgot to free it on one of the error paths.
Cc Arend van Spriel <[email protected]>Signed-off-by Dave Jones <[email protected]>
WBR, Sergei
brcmfmac: fix skb leak in brcmf_sdio_txpkt_prep_sg error path.
Commit 1eb4301867 (brcmfmac: fix txglomming scatter-gather packet transfers) added an allocation of an skb via brcmu_pkt_buf_get_skb() but forgot to free it on one of the error paths.
drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c +3 -1
@@ -1948,8 +1948,10 @@ static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus,if (pkt_pad ==NULL )return -ENOMEM ; ret =brcmf_sdio_txpkt_hdalign (bus, pkt_pad); -if (unlikely (ret <0 )) +if (unlikely (ret <0 )) { +kfree_skb (pkt_pad);return ret; + }memcpy (pkt_pad->data, pkt->data + pkt->len - tail_chop, tail_chop);