lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMuHMdXs1jNgOD4u2ncW81rfxC7xb1+hc3N2VH_Gom8f9zB+vw@mail.gmail.com>
Date:   Mon, 5 Dec 2022 09:43:20 +0100
From:   Geert Uytterhoeven <geert@...ux-m68k.org>
To:     Biju Das <biju.das.jz@...renesas.com>
Cc:     YueHaibing <yuehaibing@...wei.com>,
        "s.shtylyov@....ru" <s.shtylyov@....ru>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "phil.edworthy@...esas.com" <phil.edworthy@...esas.com>,
        Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...renesas.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-renesas-soc@...r.kernel.org" 
        <linux-renesas-soc@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net] ravb: Fix potential use-after-free in ravb_rx_gbeth()

Hi Biju,

On Sat, Dec 3, 2022 at 11:29 AM Biju Das <biju.das.jz@...renesas.com> wrote:
> > Subject: [PATCH net] ravb: Fix potential use-after-free in
> > ravb_rx_gbeth()
> >
> > The skb is delivered to napi_gro_receive() which may free it, after
> > calling this, dereferencing skb may trigger use-after-free.
>
> Can you please reconfirm the changes you have done is actually fixing any issue?
> If yes, please provide the details.
>
> Current code,
>
> napi_gro_receive(&priv->napi[q], priv->rx_1st_skb);

IIUIC, after this, priv->rx_1st_skb may have been freed...

>
> - stats->rx_bytes += priv->rx_1st_skb->len;

... so accessing priv->rx_1st_skb->len here may be a UAF.

> + stats->rx_bytes += pkt_len;

So this change looks correct to me, as pkt_len was stored to
priv->rx_1st_skb->len using skb_put() before.

Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>

>
> Note: I haven't tested your patch yet to see it cause any regression.
>
> Cheers,
> Biju
>
> >
> > Fixes: 1c59eb678cbd ("ravb: Fillup ravb_rx_gbeth() stub")
> > Signed-off-by: YueHaibing <yuehaibing@...wei.com>
> > ---
> >  drivers/net/ethernet/renesas/ravb_main.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> > b/drivers/net/ethernet/renesas/ravb_main.c
> > index 6bc923326268..33f723a9f471 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -841,7 +841,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev,
> > int *quota, int q)
> >                               napi_gro_receive(&priv->napi[q],
> >                                                priv->rx_1st_skb);
> >                               stats->rx_packets++;
> > -                             stats->rx_bytes += priv->rx_1st_skb->len;
> > +                             stats->rx_bytes += pkt_len;
> >                               break;
> >                       }
> >               }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ