]> git.baikalelectronics.ru Git - kernel.git/commit
net: sched: correct flower port blocking
authorJason Baron <jbaron@akamai.com>
Mon, 17 Feb 2020 20:38:09 +0000 (15:38 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Mar 2020 15:43:32 +0000 (16:43 +0100)
commit16d12e94bab7990f04df3a609af20adb8f19378f
treec4dabd4b9e19656570f0e8a3b03e9caf3284a2ab
parentfe3980dc54b4f497e0fec8a5ab7a3bb64e6e5d1b
net: sched: correct flower port blocking

[ Upstream commit 3f90f0108533efa07c3247df150785ff844727be ]

tc flower rules that are based on src or dst port blocking are sometimes
ineffective due to uninitialized stack data. __skb_flow_dissect() extracts
ports from the skb for tc flower to match against. However, the port
dissection is not done when when the FLOW_DIS_IS_FRAGMENT bit is set in
key_control->flags. All callers of __skb_flow_dissect(), zero-out the
key_control field except for fl_classify() as used by the flower
classifier. Thus, the FLOW_DIS_IS_FRAGMENT may be set on entry to
__skb_flow_dissect(), since key_control is allocated on the stack
and may not be initialized.

Since key_basic and key_control are present for all flow keys, let's
make sure they are initialized.

Fixes: 1ecacf51a07f ("flow_dissector: do not dissect l4 ports for fragments")
Co-developed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jason Baron <jbaron@akamai.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/net/flow_dissector.h
net/sched/cls_flower.c