netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kui-Feng Lee <sinquersw@gmail.com>
To: Victor Nogueira <victor@mojatatu.com>,
	jhs@mojatatu.com, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, xiyou.wangcong@gmail.com,
	jiri@resnulli.us
Cc: idosch@idosch.org, mleitner@redhat.com, vladbu@nvidia.com,
	paulb@nvidia.com, pctammela@mojatatu.com, netdev@vger.kernel.org,
	kernel@mojatatu.com,
	syzbot+84339b9e7330daae4d66@syzkaller.appspotmail.com,
	syzbot+806b0572c8d06b66b234@syzkaller.appspotmail.com,
	syzbot+0039110f932d438130f9@syzkaller.appspotmail.com
Subject: Re: [PATCH net-next v2 1/1] net/sched: We should only add appropriate qdiscs blocks to ports' xarray
Date: Thu, 4 Jan 2024 10:06:06 -0800	[thread overview]
Message-ID: <eb4261f0-a5b7-4438-87f2-21207d86185d@gmail.com> (raw)
In-Reply-To: <20231231172320.245375-1-victor@mojatatu.com>



On 12/31/23 09:23, Victor Nogueira wrote:
> We should only add qdiscs to the blocks ports' xarray in ingress that
> support ingress_block_set/get or in egress that support
> egress_block_set/get.
> 
> Fixes: 913b47d3424e ("net/sched: Introduce tc block netdev tracking infra")
> Signed-off-by: Victor Nogueira <victor@mojatatu.com>
> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
> Reported-by: Ido Schimmel <idosch@nvidia.com>
> Closes: https://lore.kernel.org/all/ZY1hBb8GFwycfgvd@shredder/
> Tested-by: Ido Schimmel <idosch@nvidia.com>
> Reported-and-tested-by: syzbot+84339b9e7330daae4d66@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/0000000000007c85f5060dcc3a28@google.com/
> Reported-and-tested-by: syzbot+806b0572c8d06b66b234@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/00000000000082f2f2060dcc3a92@google.com/
> Reported-and-tested-by: syzbot+0039110f932d438130f9@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/all/0000000000007fbc8c060dcc3a5c@google.com/
> ---
> v1 -> v2:
> 
> - Remove newline between fixes tag and Signed-off-by tag
> - Add Ido's Reported-by and Tested-by tags
> - Add syzbot's Reported-and-tested-by tags
> 
>   net/sched/sch_api.c | 34 ++++++++++++++++++++--------------
>   1 file changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> index 299086bb6205..426be81276f1 100644
> --- a/net/sched/sch_api.c
> +++ b/net/sched/sch_api.c
> @@ -1187,23 +1187,29 @@ static int qdisc_block_add_dev(struct Qdisc *sch, struct net_device *dev,
>   	struct tcf_block *block;
>   	int err;
>   
> -	block = cl_ops->tcf_block(sch, TC_H_MIN_INGRESS, NULL);
> -	if (block) {
> -		err = xa_insert(&block->ports, dev->ifindex, dev, GFP_KERNEL);
> -		if (err) {
> -			NL_SET_ERR_MSG(extack,
> -				       "ingress block dev insert failed");
> -			return err;
> +	if (sch->ops->ingress_block_get) {
> +		block = cl_ops->tcf_block(sch, TC_H_MIN_INGRESS, NULL);
> +		if (block) {
> +			err = xa_insert(&block->ports, dev->ifindex, dev,
> +					GFP_KERNEL);
> +			if (err) {
> +				NL_SET_ERR_MSG(extack,
> +					       "ingress block dev insert failed");
> +				return err;
> +			}
>   		}
>   	}
>   
> -	block = cl_ops->tcf_block(sch, TC_H_MIN_EGRESS, NULL);
> -	if (block) {
> -		err = xa_insert(&block->ports, dev->ifindex, dev, GFP_KERNEL);
> -		if (err) {
> -			NL_SET_ERR_MSG(extack,
> -				       "Egress block dev insert failed");
> -			goto err_out;
> +	if (sch->ops->egress_block_get) {
> +		block = cl_ops->tcf_block(sch, TC_H_MIN_EGRESS, NULL);
> +		if (block) {
> +			err = xa_insert(&block->ports, dev->ifindex, dev,
> +					GFP_KERNEL);
> +			if (err) {
> +				NL_SET_ERR_MSG(extack,
> +					       "Egress block dev insert failed");
> +				goto err_out;
> +			}
>   		}
>   	}
>   

Hi Vector,

Thank you for fixing this issue!
Could you also add a test case to avoid regression in future?
We have BPF test cases that fails for this issue. However,
not everyone run BPF selftest for netdev changes.
It would be better to have a test case for net as well.


  parent reply	other threads:[~2024-01-04 18:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-31 17:23 [PATCH net-next v2 1/1] net/sched: We should only add appropriate qdiscs blocks to ports' xarray Victor Nogueira
2024-01-02  9:59 ` Jiri Pirko
2024-01-02 14:06   ` Jamal Hadi Salim
2024-01-02 14:29     ` Jiri Pirko
2024-01-02 14:52       ` Jamal Hadi Salim
2024-01-02 15:54         ` Jiri Pirko
2024-01-02 17:06           ` Jamal Hadi Salim
2024-01-03 12:59             ` Jiri Pirko
2024-01-03 14:09               ` Jamal Hadi Salim
2024-01-03 14:26                 ` Jiri Pirko
2024-01-03 14:43                   ` Jamal Hadi Salim
2024-01-03 16:09                     ` Jiri Pirko
2024-01-03 17:08                       ` Jamal Hadi Salim
2024-01-03 18:02                         ` Jiri Pirko
2024-01-04 18:06 ` Kui-Feng Lee [this message]
2024-01-04 18:49   ` Kui-Feng Lee
2024-01-04 19:40     ` Victor Nogueira

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=eb4261f0-a5b7-4438-87f2-21207d86185d@gmail.com \
    --to=sinquersw@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=idosch@idosch.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kernel@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=mleitner@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paulb@nvidia.com \
    --cc=pctammela@mojatatu.com \
    --cc=syzbot+0039110f932d438130f9@syzkaller.appspotmail.com \
    --cc=syzbot+806b0572c8d06b66b234@syzkaller.appspotmail.com \
    --cc=syzbot+84339b9e7330daae4d66@syzkaller.appspotmail.com \
    --cc=victor@mojatatu.com \
    --cc=vladbu@nvidia.com \
    --cc=xiyou.wangcong@gmail.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).