]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/sched: cls_flower: fix only mask bit check in the validate_ct_state
authorwenxu <wenxu@ucloud.cn>
Wed, 17 Mar 2021 04:02:43 +0000 (12:02 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:30:22 +0000 (14:30 +0200)
commit5cb5b2cbeaea0817968e8d66aa48fd5ecf6da827
treeb88bd8cee70fe78c6fc4d1ab0bc1213252afb20b
parent7ad5b922075fb4bb7bfb662778464b95750a84f3
net/sched: cls_flower: fix only mask bit check in the validate_ct_state

[ Upstream commit afa536d8405a9ca36e45ba035554afbb8da27b82 ]

The ct_state validate should not only check the mask bit and also
check mask_bit & key_bit..
For the +new+est case example, The 'new' and 'est' bits should be
set in both state_mask and state flags. Or the -new-est case also
will be reject by kernel.
When Openvswitch with two flows
ct_state=+trk+new,action=commit,forward
ct_state=+trk+est,action=forward

A packet go through the kernel  and the contrack state is invalid,
The ct_state will be +trk-inv. Upcall to the ovs-vswitchd, the
finally dp action will be drop with -new-est+trk.

Fixes: 1bcc51ac0731 ("net/sched: cls_flower: Reject invalid ct_state flags rules")
Fixes: 3aed8b63336c ("net/sched: cls_flower: validate ct_state for invalid and reply flags")
Signed-off-by: wenxu <wenxu@ucloud.cn>
Reviewed-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/cls_flower.c