Linux wireless drivers development
 help / color / mirror / Atom feed
From: Arend van Spriel <arend.vanspriel@broadcom.com>
To: Peter Housel <housel@acm.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Franky Lin <franky.lin@broadcom.com>,
	Hante Meuleman <hante.meuleman@broadcom.com>,
	Kalle Valo <kvalo@codeaurora.org>,
	Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>,
	Christian Daudt <csd@broadcom.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Florian Westphal <fw@strlen.de>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
	<linux-wireless@vger.kernel.org>,
	"open list:BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER"
	<brcm80211-dev-list.pdl@broadcom.com>,
	"open list:NETWORKING DRIVERS" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain
Date: Sun, 11 Jun 2017 10:08:47 +0200	[thread overview]
Message-ID: <c4eeec0f-720d-76de-b6d9-68c882450f6f@broadcom.com> (raw)
In-Reply-To: <705684CB-D155-45DC-8146-157A536F9FBA@acm.org>

On 11-06-17 02:18, Peter Housel wrote:
> 
>> On Jun 10, 2017, at 12:27 PM, Arend van Spriel <arend.vanspriel@broadcom.com> wrote:
>>
>> On 03-06-17 17:36, Andy Shevchenko wrote:
>>> On Sat, Jun 3, 2017 at 1:29 AM, Peter S. Housel <housel@acm.org> wrote:
>>>> An earlier change to this function (3bdae810721b) fixed a leak in the
>>>> case of an unsuccessful call to brcmf_sdiod_buffrw(). However, the
>>>> glom_skb buffer, used for emulating a scattering read, is never used
>>>> or referenced after its contents are copied into the destination
>>>> buffers, and therefore always needs to be freed by the end of the
>>>> function.
>>
>> [snip]
>>
>>>> +                       skb_queue_walk(pktq, skb) {
>>>> +                               memcpy(skb->data, glom_skb->data, skb->len);
>>>> +                               skb_pull(glom_skb, skb->len);
>>>> +                       }
>>>>                }
>>>
>>>> +               brcmu_pkt_buf_free_skb(glom_skb);
>>>
>>> Can we just add this one line instead or I'm missing something?
>>
>> I guess. We don't want to walk the packet queue if glom_skb is not
>> carrying data due to brcmf_sdiod_buffrw() failure.
>>
>> So I would go with the patch below as brcmu_pkt_buf_free_skb() simply
>> ignores null pointer.
> 
> I’m fine with this, or indeed most of the other proposed solutions. The important thing is that the leak is fixed; in the driver's current state I was able to run our wearable device out of memory in just over 20 seconds running iperf.

Sure. The reason behind the suggestion from Franky was to get rid of the
label inside branch and I agree with that. To address Andy's comment I
think my proposal should tackle that.

Just out of curiosity, we added the broken-sg-support thing for OMAP
platform. So what platform/mmc-host are you using. I try to keep an
overview where this workaround is needed.

Regards,
Arend

  parent reply	other threads:[~2017-06-11  8:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-02 17:22 [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain Peter S. Housel
2017-06-02 18:48 ` Florian Fainelli
2017-06-02 18:52 ` Franky Lin
2017-06-02 22:29   ` [PATCH v2] brcmfmac: Fix glom_skb " Peter S. Housel
2017-06-03 15:36     ` Andy Shevchenko
2017-06-10 19:27       ` Arend van Spriel
     [not found]         ` <705684CB-D155-45DC-8146-157A536F9FBA@acm.org>
2017-06-11  8:08           ` Arend van Spriel [this message]
2017-06-11 13:49         ` Andy Shevchenko
2017-06-03 15:46   ` [PATCH] brcmfmac: Fix glob_skb " Andy Shevchenko

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=c4eeec0f-720d-76de-b6d9-68c882450f6f@broadcom.com \
    --to=arend.vanspriel@broadcom.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=brcm80211-dev-list.pdl@broadcom.com \
    --cc=csd@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=franky.lin@broadcom.com \
    --cc=fw@strlen.de \
    --cc=hante.meuleman@broadcom.com \
    --cc=housel@acm.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pieter-paul.giesberts@broadcom.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox