[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZNUpT+yI/OrLnxKy@google.com>
Date: Thu, 10 Aug 2023 11:15:43 -0700
From: Stanislav Fomichev <sdf@...gle.com>
To: Tirthendu Sarkar <tirthendu.sarkar@...el.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org, bjorn@...nel.org,
magnus.karlsson@...el.com, maciej.fijalkowski@...el.com,
jonathan.lemon@...il.com, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, ast@...nel.org, daniel@...earbox.net, martin.lau@...ux.dev,
dan.carpenter@...aro.org
Subject: Re: [PATCH bpf-next] xsk: fix xsk_build_skb() error: 'skb'
dereferencing possible ERR_PTR()
On 08/10, Tirthendu Sarkar wrote:
> xsk_build_skb_zerocopy() may return an error other than -EAGAIN and this
> is received as skb and used later in xsk_set_destructor_arg() and
> xsk_drop_skb() which must operate on a valid skb.
>
> Add new parameter to xsk_build_skb_zerocopy() to explicitly return error
> and invoke xsk_set_destructor_arg() and xsk_drop_skb() only for a valid
> skb.
Maybe I'm missing something, but seems more complex that it should.
Why not do the following instead?
} else if (!IS_ERR(skb)) {
xsk_set_destructor_arg(skb);
xsk_drop_skb(skb);
xskq_cons_release(xs->tx);
}
Why do we need to separate the err?
Powered by blists - more mailing lists