Skip to content

Commit

Permalink
xdp: Fix xsk_generic_xmit errno
Browse files Browse the repository at this point in the history
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: 35fcde7 ("xsk: support for Tx")
Signed-off-by: Li RongQing <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Björn Töpel <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
lrq-max authored and borkmann committed Jun 11, 2020
1 parent d4060ac commit aa2cad0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/xdp/xsk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit aa2cad0

Please sign in to comment.