提交 b3d48838 编写于 作者: P Paul Blakey 提交者: Zheng Zengkai

skbuff: Release nfct refcount on napi stolen or re-used skbs

stable inclusion
from stable-5.10.54
commit 570341f10eccfe5c339363544a0339a8550944b7
bugzilla: 175586 https://gitee.com/openeuler/kernel/issues/I4DVDU

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=570341f10eccfe5c339363544a0339a8550944b7

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

commit 8550ff8d upstream.

When multiple SKBs are merged to a new skb under napi GRO,
or SKB is re-used by napi, if nfct was set for them in the
driver, it will not be released while freeing their stolen
head state or on re-use.

Release nfct on napi's stolen or re-used SKBs, and
in gro_list_prepare, check conntrack metadata diff.

Fixes: 5c6b9460 ("net/mlx5e: CT: Handle misses after executing CT action")
Reviewed-by: NRoi Dayan <roid@nvidia.com>
Signed-off-by: NPaul Blakey <paulb@nvidia.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 22ddc3ff
...@@ -5870,6 +5870,18 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi, ...@@ -5870,6 +5870,18 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi,
diffs = memcmp(skb_mac_header(p), diffs = memcmp(skb_mac_header(p),
skb_mac_header(skb), skb_mac_header(skb),
maclen); maclen);
diffs |= skb_get_nfct(p) ^ skb_get_nfct(skb);
if (!diffs) {
struct tc_skb_ext *skb_ext = skb_ext_find(skb, TC_SKB_EXT);
struct tc_skb_ext *p_ext = skb_ext_find(p, TC_SKB_EXT);
diffs |= (!!p_ext) ^ (!!skb_ext);
if (!diffs && unlikely(skb_ext))
diffs |= p_ext->chain ^ skb_ext->chain;
}
NAPI_GRO_CB(p)->same_flow = !diffs; NAPI_GRO_CB(p)->same_flow = !diffs;
} }
...@@ -6149,6 +6161,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) ...@@ -6149,6 +6161,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
skb_shinfo(skb)->gso_type = 0; skb_shinfo(skb)->gso_type = 0;
skb->truesize = SKB_TRUESIZE(skb_end_offset(skb)); skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));
skb_ext_reset(skb); skb_ext_reset(skb);
nf_reset_ct(skb);
napi->skb = skb; napi->skb = skb;
} }
......
...@@ -659,6 +659,7 @@ static void kfree_skbmem(struct sk_buff *skb) ...@@ -659,6 +659,7 @@ static void kfree_skbmem(struct sk_buff *skb)
void skb_release_head_state(struct sk_buff *skb) void skb_release_head_state(struct sk_buff *skb)
{ {
nf_reset_ct(skb);
skb_dst_drop(skb); skb_dst_drop(skb);
if (skb->destructor) { if (skb->destructor) {
WARN_ON(in_irq()); WARN_ON(in_irq());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册