All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: netdev@vger.kernel.org
Cc: arend@broadcom.com, linville@tuxdriver.com,
	linux-coverity@vger.kernel.org
Subject: Re: brcmfmac: fix txglomming scatter-gather packet transfers
Date: Thu, 6 Mar 2014 01:09:36 -0500	[thread overview]
Message-ID: <20140306060936.GB26578@redhat.com> (raw)
In-Reply-To: <20140305192636.D06AA660D72@gitolite.kernel.org>

On Wed, Mar 05, 2014 at 07:26:36PM +0000, Linux Kernel wrote:
 
 > Commit:     1eb43018673e735ea9cd756970f4e71ca01a5f21
 > Parent:     21f8aaee0c62708654988ce092838aa7df4d25d8
 > Author:     Arend van Spriel <arend@broadcom.com>
 > AuthorDate: Thu Feb 20 18:55:55 2014 +0100
 > Committer:  John W. Linville <linville@tuxdriver.com>
 > CommitDate: Thu Feb 20 15:53:20 2014 -0500
 > 
 >     brcmfmac: fix txglomming scatter-gather packet transfers

Coverity just flagged this code.

 >  	if (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.

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index 119ee6eaf1c3..ddaa9efd053d 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -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);

       reply	other threads:[~2014-03-06  6:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140305192636.D06AA660D72@gitolite.kernel.org>
2014-03-06  6:09 ` Dave Jones [this message]
2014-03-06  8:51   ` brcmfmac: fix txglomming scatter-gather packet transfers Arend van Spriel
2014-03-06 17:03     ` brcmfmac: fix skb leak in brcmf_sdio_txpkt_prep_sg error path Dave Jones
2014-03-06 18:02       ` Arend van Spriel
2014-03-06 21:41       ` Sergei Shtylyov
2014-03-06 20:51         ` Dave Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140306060936.GB26578@redhat.com \
    --to=davej@redhat.com \
    --cc=arend@broadcom.com \
    --cc=linux-coverity@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.