[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANn89iLS6rhm_N6g-x0JQC8s2Kx2yVO7+r89BdBZNrzr9473WQ@mail.gmail.com>
Date: Fri, 15 Jul 2022 11:17:59 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Zhengchao Shao <shaozhengchao@...wei.com>,
bpf <bpf@...r.kernel.org>, netdev <netdev@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Paolo Abeni <pabeni@...hat.com>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, martin.lau@...ux.dev,
song@...nel.org, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...gle.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Menglong Dong <imagedong@...cent.com>,
Petr Machata <petrm@...dia.com>, Arnd Bergmann <arnd@...db.de>,
David Ahern <dsahern@...nel.org>,
Talal Ahmad <talalahmad@...gle.com>,
Kees Cook <keescook@...omium.org>, Hao Luo <haoluo@...gle.com>,
jolsa@...nel.org, weiyongjun1@...wei.com,
YueHaibing <yuehaibing@...wei.com>
Subject: Re: [PATCH v3,bpf-next] bpf: Don't redirect packets with invalid pkt_len
On Fri, Jul 15, 2022 at 6:30 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Fri, 15 Jul 2022 11:22:33 +0800 Zhengchao Shao wrote:
> > +#ifdef CONFIG_DEBUG_NET
> > + if (unlikely(!skb->len)) {
> > + pr_err("%s\n", __func__);
> > + skb_dump(KERN_ERR, skb, false);
> > + WARN_ON_ONCE(1);
> > + }
>
> Is there a reason to open code WARN_ONCE() like that?
>
> #ifdef CONFIG_DEBUG_NET
> if (WARN_ONCE(!skb->len, "%s\n", __func__))
> skb_dump(KERN_ERR, skb, false);
>
> or
>
> if (IS_ENABLED(CONFIG_DEBUG_NET) &&
> WARN_ONCE(!skb->len, "%s\n", __func__))
> skb_dump(KERN_ERR, skb, false);
Also the skb_dump() needs to be done once.
DO_ONCE_LITE(skb_dump, KERN_ERR, skb, false);
Powered by blists - more mailing lists