Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1656855

Re: [PATCH v2] brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2] brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain
Date 2017-06-03 17:40 +0200
Message-ID <tOjjH-jM-1@gated-at.bofh.it> (permalink)
References <tNZXH-4Tg-1@gated-at.bofh.it> <tO3oB-78v-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

>                 err = brcmf_sdiod_buffrw(sdiodev, SDIO_FUNC_2, false, addr,
>                                          glom_skb);
> -               if (err) {
> -                       brcmu_pkt_buf_free_skb(glom_skb);
> -                       goto done;
> -               }
> -
> -               skb_queue_walk(pktq, skb) {
> -                       memcpy(skb->data, glom_skb->data, skb->len);
> -                       skb_pull(glom_skb, skb->len);

> +               if (!err) {

This is not so often in use type of pattern.

> +                       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?

>         } else
>                 err = brcmf_sdiod_sglist_rw(sdiodev, SDIO_FUNC_2, false, addr,
>                                             pktq);



-- 
With Best Regards,
Andy Shevchenko

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain "Peter S. Housel" <housel@acm.org> - 2017-06-02 19:40 +0200
  Re: [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain Florian Fainelli <f.fainelli@gmail.com> - 2017-06-02 20:50 +0200
  Re: [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain Franky Lin <franky.lin@broadcom.com> - 2017-06-02 21:00 +0200
    [PATCH v2] brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain "Peter S. Housel" <housel@acm.org> - 2017-06-03 00:40 +0200
      Re: [PATCH v2] brcmfmac: Fix glom_skb leak in brcmf_sdiod_recv_chain Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-03 17:40 +0200
    Re: [PATCH] brcmfmac: Fix glob_skb leak in brcmf_sdiod_recv_chain Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-06-03 17:50 +0200

csiph-web