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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1678846773.823149-1-xuanzhuo@linux.alibaba.com>
Date:   Wed, 15 Mar 2023 10:19:33 +0800
From:   Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
To:     Yunsheng Lin <linyunsheng@...wei.com>
Cc:     "Michael S. Tsirkin" <mst@...hat.com>,
        Jason Wang <jasowang@...hat.com>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Jesper Dangaard Brouer <hawk@...nel.org>,
        John Fastabend <john.fastabend@...il.com>,
        Heng Qi <hengqi@...ux.alibaba.com>,
        <virtualization@...ts.linux-foundation.org>, <bpf@...r.kernel.org>,
        <netdev@...r.kernel.org>
Subject: Re: [PATCH net v2 2/2] virtio_net: free xdp shinfo frags when build_skb_from_xdp_buff() fails

On Wed, 15 Mar 2023 10:14:34 +0800, Yunsheng Lin <linyunsheng@...wei.com> wrote:
> On 2023/3/15 9:52, Xuan Zhuo wrote:
> > build_skb_from_xdp_buff() may return NULL, in this case
> > we need to free the frags of xdp shinfo.
> >
> > Fixes: fab89bafa95b ("virtio-net: support multi-buffer xdp")
> > Signed-off-by: Xuan Zhuo <xuanzhuo@...ux.alibaba.com>
> > Acked-by: Michael S. Tsirkin <mst@...hat.com>
> > ---
> >  drivers/net/virtio_net.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 8ecf7a341d54..2396c28c0122 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -1273,9 +1273,12 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
> >
> >  		switch (act) {
> >  		case XDP_PASS:
> > +			head_skb = build_skb_from_xdp_buff(dev, vi, &xdp, xdp_frags_truesz);
> > +			if (unlikely(!head_skb))
> > +				goto err_xdp_frags;
>
> LGTM.
> Reviewed-by: Yunsheng Lin <linyunsheng@...wei.com>
>
> Note, "stats->drops++; dev_kfree_skb(head_skb);" is also done for the above case,
> I assume it is ok as other "goto err_xdp_frags" case also do that.


Yes. It's ok.

Thanks.


>
> > +
> >  			if (unlikely(xdp_page != page))
> >  				put_page(page);
> > -			head_skb = build_skb_from_xdp_buff(dev, vi, &xdp, xdp_frags_truesz);
> >  			rcu_read_unlock();
> >  			return head_skb;
> >  		case XDP_TX:
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ