diff options
author | Li RongQing <lirongqing@baidu.com> | 2020-06-11 07:11:06 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-06-11 23:44:33 +0200 |
commit | aa2cad0600ed2ca6a0ab39948d4db1666b6c962b (patch) | |
tree | 2916f14c96f58814b34ae50940de56d6fdbd8692 /net/xdp | |
parent | tools, bpftool: Fix memory leak in codegen error cases (diff) | |
download | linux-aa2cad0600ed2ca6a0ab39948d4db1666b6c962b.tar.xz linux-aa2cad0600ed2ca6a0ab39948d4db1666b6c962b.zip |
xdp: Fix xsk_generic_xmit errno
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
Diffstat (limited to 'net/xdp')
-rw-r--r-- | net/xdp/xsk.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c index b6c0f08bd80d..3700266229f6 100644 --- a/net/xdp/xsk.c +++ b/net/xdp/xsk.c @@ -352,10 +352,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; |