]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
xdp: Fix xsk_generic_xmit errno
authorLi RongQing <lirongqing@baidu.com>
Thu, 11 Jun 2020 05:11:06 +0000 (13:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:49:11 +0000 (17:49 +0200)
[ Upstream commit aa2cad0600ed2ca6a0ab39948d4db1666b6c962b ]

Propagate sock_alloc_send_skb error code, not set it to
EAGAIN unconditionally, when fail to allocate skb, which
might cause that user space unnecessary loops.

Fixes: 35fcde7f8deb ("xsk: support for Tx")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Björn Töpel <bjorn.topel@intel.com>
Link: https://lore.kernel.org/bpf/1591852266-24017-1-git-send-email-lirongqing@baidu.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/xdp/xsk.c

index c350108aa38de784b2652bffcc1732191e93ed88..a4676107fad0557ca175212e8235e2e9cddb4631 100644 (file)
@@ -397,10 +397,8 @@ static int xsk_generic_xmit(struct sock *sk)
 
                len = desc.len;
                skb = sock_alloc_send_skb(sk, len, 1, &err);
-               if (unlikely(!skb)) {
-                       err = -EAGAIN;
+               if (unlikely(!skb))
                        goto out;
-               }
 
                skb_put(skb, len);
                addr = desc.addr;