From: kernel test robot <lkp@intel.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch
Cc: oe-kbuild-all@lists.linux.dev, netdev@vger.kernel.org,
xiyou.wangcong@gmail.com, jiri@resnulli.us, victor@mojatatu.com,
Jamal Hadi Salim <jhs@mojatatu.com>
Subject: Re: [PATCH net 1/2] net/sched: act_mirred: Fix leak when redirecting to self on egress
Date: Thu, 1 Jan 2026 22:24:58 +0100 [thread overview]
Message-ID: <202601012235.hi5VYzYy-lkp@intel.com> (raw)
In-Reply-To: <20251230191814.213789-1-jhs@mojatatu.com>
Hi Jamal,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net/main]
url: https://github.com/intel-lab-lkp/linux/commits/Jamal-Hadi-Salim/selftests-tc-testing-Add-test-case-redirecting-to-self-on-egress/20251231-031934
base: net/main
patch link: https://lore.kernel.org/r/20251230191814.213789-1-jhs%40mojatatu.com
patch subject: [PATCH net 1/2] net/sched: act_mirred: Fix leak when redirecting to self on egress
config: i386-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260101/202601012235.hi5VYzYy-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260101/202601012235.hi5VYzYy-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601012235.hi5VYzYy-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> net/sched/act_mirred.c:271:41: warning: variable 'at_ingress' is uninitialized when used here [-Wuninitialized]
271 | if (dev == skb->dev && want_ingress == at_ingress) {
| ^~~~~~~~~~
net/sched/act_mirred.c:256:17: note: initialize the variable 'at_ingress' to silence this warning
256 | bool at_ingress;
| ^
| = 0
1 warning generated.
vim +/at_ingress +271 net/sched/act_mirred.c
246
247 static int tcf_mirred_to_dev(struct sk_buff *skb, struct tcf_mirred *m,
248 struct net_device *dev,
249 const bool m_mac_header_xmit, int m_eaction,
250 int retval)
251 {
252 struct sk_buff *skb_to_send = skb;
253 bool want_ingress;
254 bool is_redirect;
255 bool expects_nh;
256 bool at_ingress;
257 bool dont_clone;
258 int mac_len;
259 bool at_nh;
260 int err;
261
262 is_redirect = tcf_mirred_is_act_redirect(m_eaction);
263 if (unlikely(!(dev->flags & IFF_UP)) || !netif_carrier_ok(dev)) {
264 net_notice_ratelimited("tc mirred to Houston: device %s is down\n",
265 dev->name);
266 goto err_cant_do;
267 }
268
269 want_ingress = tcf_mirred_act_wants_ingress(m_eaction);
270
> 271 if (dev == skb->dev && want_ingress == at_ingress) {
272 pr_notice_once("tc mirred: Loop (%s:%s --> %s:%s)\n",
273 netdev_name(skb->dev),
274 at_ingress ? "ingress" : "egress",
275 netdev_name(dev),
276 want_ingress ? "ingress" : "egress");
277 goto err_cant_do;
278 }
279
280 /* we could easily avoid the clone only if called by ingress and clsact;
281 * since we can't easily detect the clsact caller, skip clone only for
282 * ingress - that covers the TC S/W datapath.
283 */
284 at_ingress = skb_at_tc_ingress(skb);
285 dont_clone = skb_at_tc_ingress(skb) && is_redirect &&
286 tcf_mirred_can_reinsert(retval);
287 if (!dont_clone) {
288 skb_to_send = skb_clone(skb, GFP_ATOMIC);
289 if (!skb_to_send)
290 goto err_cant_do;
291 }
292
293 /* All mirred/redirected skbs should clear previous ct info */
294 nf_reset_ct(skb_to_send);
295 if (want_ingress && !at_ingress) /* drop dst for egress -> ingress */
296 skb_dst_drop(skb_to_send);
297
298 expects_nh = want_ingress || !m_mac_header_xmit;
299 at_nh = skb->data == skb_network_header(skb);
300 if (at_nh != expects_nh) {
301 mac_len = at_ingress ? skb->mac_len :
302 skb_network_offset(skb);
303 if (expects_nh) {
304 /* target device/action expect data at nh */
305 skb_pull_rcsum(skb_to_send, mac_len);
306 } else {
307 /* target device/action expect data at mac */
308 skb_push_rcsum(skb_to_send, mac_len);
309 }
310 }
311
312 skb_to_send->skb_iif = skb->dev->ifindex;
313 skb_to_send->dev = dev;
314
315 if (is_redirect) {
316 if (skb == skb_to_send)
317 retval = TC_ACT_CONSUMED;
318
319 skb_set_redirected(skb_to_send, skb_to_send->tc_at_ingress);
320
321 err = tcf_mirred_forward(at_ingress, want_ingress, skb_to_send);
322 } else {
323 err = tcf_mirred_forward(at_ingress, want_ingress, skb_to_send);
324 }
325 if (err)
326 tcf_action_inc_overlimit_qstats(&m->common);
327
328 return retval;
329
330 err_cant_do:
331 if (is_redirect)
332 retval = TC_ACT_SHOT;
333 tcf_action_inc_overlimit_qstats(&m->common);
334 return retval;
335 }
336
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2026-01-01 21:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-30 19:18 [PATCH net 1/2] net/sched: act_mirred: Fix leak when redirecting to self on egress Jamal Hadi Salim
2025-12-30 19:18 ` [PATCH net 2/2] selftests/tc-testing: Add test case " Jamal Hadi Salim
2025-12-30 21:32 ` [PATCH net 1/2] net/sched: act_mirred: Fix leak when " Jamal Hadi Salim
2026-01-01 21:24 ` kernel test robot [this message]
2026-01-01 21:45 ` Jamal Hadi Salim
2026-01-04 7:09 ` kernel test robot
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=202601012235.hi5VYzYy-lkp@intel.com \
--to=lkp@intel.com \
--cc=andrew+netdev@lunn.ch \
--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=netdev@vger.kernel.org \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=pabeni@redhat.com \
--cc=victor@mojatatu.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