[SRU][F:linux-bluefield][PATCH v1 3/4] net: sched: initialize with 0 before setting erspan md->u
Tony Duan
yifeid at nvidia.com
Tue Apr 18 02:44:47 UTC 2023
From: Xin Long <lucien.xin at gmail.com>
BugLink: https://bugs.launchpad.net/bugs/2016829
In fl_set_erspan_opt(), all bits of erspan md was set 1, as this
function is also used to set opt MASK. However, when setting for
md->u.index for opt VALUE, the rest bits of the union md->u will
be left 1. It would cause to fail the match of the whole md when
version is 1 and only index is set.
This patch is to fix by initializing with 0 before setting erspan
md->u.
Reported-by: Shuang Li <shuali at redhat.com>
Fixes: 79b1011cb33d ("net: sched: allow flower to match erspan options")
Signed-off-by: Xin Long <lucien.xin at gmail.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 8e1b3ac4786680c2d2b5a24e38a2d714c3bcd1ef)
Signed-off-by: Tony Duan <yifeid at nvidia.com>
---
net/sched/cls_flower.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index c347861dfcc1..881736539968 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -1060,6 +1060,7 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key,
}
if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) {
nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX];
+ memset(&md->u, 0x00, sizeof(md->u));
md->u.index = nla_get_be32(nla);
}
} else if (md->version == 2) {
--
2.25.1
More information about the kernel-team
mailing list