From: Cong Wang <xiyou.wangcong@gmail.com>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
Jiri Pirko <jiri@resnulli.us>,
Ilya Maximets <i.maximets@redhat.com>,
Frode Nordahl <frode.nordahl@canonical.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH net] tc: Ensure we have enough buffer space when sending filter netlink notifications
Date: Wed, 9 Apr 2025 10:36:40 -0700 [thread overview]
Message-ID: <Z/awKFETLHDwN6dE@pop-os.localdomain> (raw)
In-Reply-To: <20250407105542.16601-1-toke@redhat.com>
On Mon, Apr 07, 2025 at 12:55:34PM +0200, Toke Høiland-Jørgensen wrote:
> +static struct sk_buff *tfilter_notify_prep(struct net *net,
> + struct sk_buff *oskb,
> + struct nlmsghdr *n,
> + struct tcf_proto *tp,
> + struct tcf_block *block,
> + struct Qdisc *q, u32 parent,
> + void *fh, int event,
> + u32 portid, bool rtnl_held,
> + struct netlink_ext_ack *extack)
> +{
> + unsigned int size = oskb ? max(NLMSG_GOODSIZE, oskb->len) : NLMSG_GOODSIZE;
> + struct sk_buff *skb;
> + int ret;
> +
> +retry:
> + skb = alloc_skb(size, GFP_KERNEL);
> + if (!skb)
> + return ERR_PTR(-ENOBUFS);
> +
> + ret = tcf_fill_node(net, skb, tp, block, q, parent, fh, portid,
> + n->nlmsg_seq, n->nlmsg_flags, event, false,
> + rtnl_held, extack);
> + if (ret <= 0) {
> + kfree_skb(skb);
> + if (ret == -EMSGSIZE) {
> + size += NLMSG_GOODSIZE;
> + goto retry;
It is a bit concerning to see this technically unbound loop.
> + }
> + return ERR_PTR(-EINVAL);
I think you probably want to propagate the error code from
tcf_fill_node() here.
Thanks.
next prev parent reply other threads:[~2025-04-09 17:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 10:55 [PATCH net] tc: Ensure we have enough buffer space when sending filter netlink notifications Toke Høiland-Jørgensen
2025-04-07 11:12 ` Jiri Pirko
2025-04-08 11:57 ` Paolo Abeni
2025-04-08 12:59 ` Toke Høiland-Jørgensen
2025-04-08 12:10 ` patchwork-bot+netdevbpf
2025-04-09 17:36 ` Cong Wang [this message]
2025-04-10 10:28 ` Toke Høiland-Jørgensen
2025-04-14 21:00 ` Cong Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z/awKFETLHDwN6dE@pop-os.localdomain \
--to=xiyou.wangcong@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=frode.nordahl@canonical.com \
--cc=horms@kernel.org \
--cc=i.maximets@redhat.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toke@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).