summaryrefslogtreecommitdiff
path: root/net/sched
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2020-09-13 14:43:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-26 19:05:24 +0300
commitabdd468785e1580d4e0c33d4914ccce9e06da2e1 (patch)
tree11b8d7d518ce6b71321d112ba2deee346e2ef772 /net/sched
parent9286233285ba5dd927333f83d8654fb967dfef74 (diff)
downloadlinux-abdd468785e1580d4e0c33d4914ccce9e06da2e1.tar.xz
net: sched: initialize with 0 before setting erspan md->u
[ Upstream commit 8e1b3ac4786680c2d2b5a24e38a2d714c3bcd1ef ] 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@redhat.com> Fixes: 79b1011cb33d ("net: sched: allow flower to match erspan options") Signed-off-by: Xin Long <lucien.xin@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/cls_flower.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index e30bd969fc48..5fe145d97f52 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -1215,6 +1215,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) {