netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Khawar Ahemad <ahemadkhawar123@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, jhs@mojatatu.com, jiri@resnulli.us,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, horms@kernel.org, ahemadkhawar123@gmail.com
Subject: [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace
Date: Tue, 25 Aug 2026 21:31:43 +0530	[thread overview]
Message-ID: <20260825160143.86866-1-ahemadkhawar123@gmail.com> (raw)

When replacing an existing sample action, if TCA_SAMPLE_TRUNC_SIZE is not
passed in the netlink request, s->truncate and s->trunc_size retain their
previous values from the prior configuration.

As a result, a user cannot disable packet truncation when replacing a
sample action unless the action is fully deleted and recreated. In
addition, the hardware offload state and netlink dump continue to report
truncation as active.

Fix this by explicitly resetting s->truncate to false and s->trunc_size
to 0 when TCA_SAMPLE_TRUNC_SIZE is omitted during tcf_sample_init().

Fixes: 5c56784d852a ("net/sched: act_sample: add support for packet truncation")
Signed-off-by: Khawar Ahemad <ahemadkhawar123@gmail.com>
---
 net/sched/act_sample.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 2ceb4d141b..2bdc7a0eb6 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -116,6 +116,9 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
 	if (tb[TCA_SAMPLE_TRUNC_SIZE]) {
 		s->truncate = true;
 		s->trunc_size = nla_get_u32(tb[TCA_SAMPLE_TRUNC_SIZE]);
+	} else {
+		s->truncate = false;
+		s->trunc_size = 0;
 	}
 	spin_unlock_bh(&s->tcf_lock);
 
-- 
2.54.0 (Apple Git-157)


             reply	other threads:[~2026-08-25 16:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25 16:01 Khawar Ahemad [this message]
2026-08-25 17:03 ` [PATCH net-next] net/sched: act_sample: reset truncation settings on action replace Victor Nogueira
2026-08-27  8:11 ` Paolo Abeni

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=20260825160143.86866-1-ahemadkhawar123@gmail.com \
    --to=ahemadkhawar123@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@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).