提交 32c726f1 编写于 作者: A Ariel Levkovich 提交者: Zheng Zengkai

net/sched: act_ct: Fix ct template allocation for zone 0

stable inclusion
from stable-5.10.43
commit be0d8507268646a6ca524c0f40f29c501b3d78d9
bugzilla: 109284
CVE: NA

--------------------------------

[ Upstream commit fb91702b ]

Fix current behavior of skipping template allocation in case the
ct action is in zone 0.

Skipping the allocation may cause the datapath ct code to ignore the
entire ct action with all its attributes (commit, nat) in case the ct
action in zone 0 was preceded by a ct clear action.

The ct clear action sets the ct_state to untracked and resets the
skb->_nfct pointer. Under these conditions and without an allocated
ct template, the skb->_nfct pointer will remain NULL which will
cause the tc ct action handler to exit without handling commit and nat
actions, if such exist.

For example, the following rule in OVS dp:
recirc_id(0x2),ct_state(+new-est-rel-rpl+trk),ct_label(0/0x1), \
in_port(eth0),actions:ct_clear,ct(commit,nat(src=10.11.0.12)), \
recirc(0x37a)

Will result in act_ct skipping the commit and nat actions in zone 0.

The change removes the skipping of template allocation for zone 0 and
treats it the same as any other zone.

Fixes: b57dc7c1 ("net/sched: Introduce action ct")
Signed-off-by: NAriel Levkovich <lariel@nvidia.com>
Acked-by: NMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Link: https://lore.kernel.org/r/20210526170110.54864-1-lariel@nvidia.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 aed61203
...@@ -1199,9 +1199,6 @@ static int tcf_ct_fill_params(struct net *net, ...@@ -1199,9 +1199,6 @@ static int tcf_ct_fill_params(struct net *net,
sizeof(p->zone)); sizeof(p->zone));
} }
if (p->zone == NF_CT_DEFAULT_ZONE_ID)
return 0;
nf_ct_zone_init(&zone, p->zone, NF_CT_DEFAULT_ZONE_DIR, 0); nf_ct_zone_init(&zone, p->zone, NF_CT_DEFAULT_ZONE_DIR, 0);
tmpl = nf_ct_tmpl_alloc(net, &zone, GFP_KERNEL); tmpl = nf_ct_tmpl_alloc(net, &zone, GFP_KERNEL);
if (!tmpl) { if (!tmpl) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册