[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW6GQqzvyx6XY6ymmPiimH785fvmSRwePH9d_wS=9MS=3Q@mail.gmail.com>
Date: Wed, 27 Jun 2018 11:19:50 -0700
From: Song Liu <liu.song.a23@...il.com>
To: Magnus Karlsson <magnus.karlsson@...el.com>
Cc: bjorn.topel@...el.com, ast@...com,
Daniel Borkmann <daniel@...earbox.net>,
Networking <netdev@...r.kernel.org>, qi.z.zhang@...el.com,
pavel@...tnetmon.com
Subject: Re: [PATCH bpf 2/4] xsk: frame could be completed more than once in
SKB path
On Wed, Jun 27, 2018 at 7:02 AM, Magnus Karlsson
<magnus.karlsson@...el.com> wrote:
> Fixed a bug in which a frame could be completed more than once
> when an error was returned from dev_direct_xmit(). The code
> erroneously retried sending the message leading to multiple
> calls to the SKB destructor and therefore multiple completions
> of the same buffer to user space.
>
> The error code in this case has been changed from EAGAIN to EBUSY
> in order to tell user space that the sending of the packet failed
> and the buffer has been return to user space through the completion
> queue.
>
> Fixes: 35fcde7f8deb ("xsk: support for Tx")
> Signed-off-by: Magnus Karlsson <magnus.karlsson@...el.com>
> Reported-by: Pavel Odintsov <pavel@...tnetmon.com>
Acked-by: Song Liu <songliubraving@...com>
> ---
> net/xdp/xsk.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index 3b3410ada097..d482f727f4c2 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c
> @@ -268,15 +268,15 @@ static int xsk_generic_xmit(struct sock *sk, struct msghdr *m,
> skb->destructor = xsk_destruct_skb;
>
> err = dev_direct_xmit(skb, xs->queue_id);
> + xskq_discard_desc(xs->tx);
> /* Ignore NET_XMIT_CN as packet might have been sent */
> if (err == NET_XMIT_DROP || err == NETDEV_TX_BUSY) {
> - err = -EAGAIN;
> - /* SKB consumed by dev_direct_xmit() */
> + /* SKB completed but not sent */
> + err = -EBUSY;
> goto out;
> }
>
> sent_frame = true;
> - xskq_discard_desc(xs->tx);
> }
>
> out:
> --
> 2.7.4
>
Powered by blists - more mailing lists