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 --- 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