netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Manas Ghandat <ghandatmanas@gmail.com>
Cc: xiyou.wangcong@gmail.com, Jiri Pirko <jiri@resnulli.us>,
	"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: net/sched: Fix divide error in tabledist
Date: Fri, 12 Dec 2025 17:18:56 +0900	[thread overview]
Message-ID: <20251212171856.37cfb4dd@stephen-xps.local> (raw)
In-Reply-To: <f69b2c8f-8325-4c2e-a011-6dbc089f30e4@gmail.com>

On Thu, 11 Dec 2025 23:36:32 +0530
Manas Ghandat <ghandatmanas@gmail.com> wrote:

> Previously, a duplication check was added to ensure that a
> duplicating netem cannot exist in a tree with other netems. When
> check_netem_in_tree() fails after parameter updates, the qdisc
> structure is left in an inconsistent state with some new values
> applied but duplicate not updated. Move the tree validation check
> before modifying any qdisc parameters
> Fixes: ec8e0e3d7ade ("net/sched: Restrict conditions for adding 
> duplicating netems to qdisc tree")
> Reported-by: Manas Ghandat <ghandatmanas@gmail.com>
> Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
> ---
> net/sched/sch_netem.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
> diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
> index 32a5f3304046..1a2b498ada83 100644
> --- a/net/sched/sch_netem.c
> +++ b/net/sched/sch_netem.c
> @@ -1055,6 +1055,11 @@ static int netem_change(struct Qdisc *sch, struct 
> nlattr *opt,
> q->loss_model = CLG_RANDOM;
> }
> + ret = check_netem_in_tree(sch, qopt->duplicate, extack);
> + if (ret)
> + goto unlock;
> + q->duplicate = qopt->duplicate;
> +
> if (delay_dist)
> swap(q->delay_dist, delay_dist);
> if (slot_dist)
> @@ -1068,12 +1073,6 @@ static int netem_change(struct Qdisc *sch, struct 
> nlattr *opt,
> q->counter = 0;
> q->loss = qopt->loss;
> - ret = check_netem_in_tree(sch, qopt->duplicate, extack);
> - if (ret)
> - goto unlock;
> -
> - q->duplicate = qopt->duplicate;
> -
> /* for compatibility with earlier versions.
> * if gap is set, need to assume 100% probability
> */

Agree the netem_in_tree error path is incorrect.
The whole netem_in_tree check is problematic as well.

Your mail system is corrupting the patch. The whitespace is messed up.
Is this the same as earlier patch


  reply	other threads:[~2025-12-12  8:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-11 18:06 net/sched: Fix divide error in tabledist Manas Ghandat
2025-12-12  8:18 ` Stephen Hemminger [this message]
2025-12-12 15:17   ` Manas Ghandat
2025-12-17 18:27     ` Manas Ghandat
2025-12-21 17:03       ` Stephen Hemminger

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=20251212171856.37cfb4dd@stephen-xps.local \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ghandatmanas@gmail.com \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).