Netdev List
 help / color / mirror / Atom feed
From: Haon KIM <akrn112@naver.com>
To: dsahern@kernel.org
Cc: netdev@vger.kernel.org, Haon KIM <akrn112@naver.com>
Subject: [PATCH] net: l3mdev: Set OIF flag only when an L3 master exists
Date: Sun, 25 Oct 2026 02:57:46 +0900	[thread overview]
Message-ID: <20261024175746.2341-1-akrn112@naver.com> (raw)

l3mdev_master_ifindex_rcu() may return 0 when the device is not
associated with an L3 master. In that case, l3mdev_update_flow()
currently sets FLOWI_FLAG_L3MDEV_OIF even though flowi_l3mdev
remains 0.

Set FLOWI_FLAG_L3MDEV_OIF only when a non-zero L3 master ifindex
is returned, keeping the flag consistent with flowi_l3mdev.

Signed-off-by: Haon KIM <akrn112@naver.com>
---
 net/l3mdev/l3mdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/l3mdev/l3mdev.c b/net/l3mdev/l3mdev.c
index 5432a5f2dfc8..92b48d6a4301 100644
--- a/net/l3mdev/l3mdev.c
+++ b/net/l3mdev/l3mdev.c
@@ -279,7 +279,8 @@ void l3mdev_update_flow(struct net *net, struct flowi *fl)
 		if (dev) {
 			if (!fl->flowi_l3mdev) {
 				fl->flowi_l3mdev = l3mdev_master_ifindex_rcu(dev);
-				fl->flowi_flags |= FLOWI_FLAG_L3MDEV_OIF;
+				if (fl->flowi_l3mdev)
+					fl->flowi_flags |= FLOWI_FLAG_L3MDEV_OIF;
 			}
 
 			/* oif set to L3mdev directs lookup to its table;
-- 
2.37.0


             reply	other threads:[~2026-10-24 18:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24 17:57 Haon KIM [this message]
2026-10-26  8:30 ` [PATCH] net: l3mdev: Set OIF flag only when an L3 master exists Daniel Machon

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=20261024175746.2341-1-akrn112@naver.com \
    --to=akrn112@naver.com \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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