提交 0c5c16c4 编写于 作者: P Pablo Neira Ayuso 提交者: Zheng Zengkai

netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find()

stable inclusion
from stable-v5.10.146
commit 5d75fef3e61e797fab5c3fbba88caa74ab92ad47
category: bugfix
bugzilla: 187890, https://gitee.com/src-openeuler/kernel/issues/I5X2IJ
CVE: CVE-2022-42432

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

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

[ Upstream commit 559c36c5 ]

nf_osf_find() incorrectly returns true on mismatch, this leads to
copying uninitialized memory area in nft_osf which can be used to leak
stale kernel stack data to userspace.

Fixes: 22c7652c ("netfilter: nft_osf: Add version option support")
Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: NFlorian Westphal <fw@strlen.de>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NLu Wei <luwei32@huawei.com>
Reviewed-by: NYue Haibing <yuehaibing@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 6c736224
...@@ -269,6 +269,7 @@ bool nf_osf_find(const struct sk_buff *skb, ...@@ -269,6 +269,7 @@ bool nf_osf_find(const struct sk_buff *skb,
struct nf_osf_hdr_ctx ctx; struct nf_osf_hdr_ctx ctx;
const struct tcphdr *tcp; const struct tcphdr *tcp;
struct tcphdr _tcph; struct tcphdr _tcph;
bool found = false;
memset(&ctx, 0, sizeof(ctx)); memset(&ctx, 0, sizeof(ctx));
...@@ -283,10 +284,11 @@ bool nf_osf_find(const struct sk_buff *skb, ...@@ -283,10 +284,11 @@ bool nf_osf_find(const struct sk_buff *skb,
data->genre = f->genre; data->genre = f->genre;
data->version = f->version; data->version = f->version;
found = true;
break; break;
} }
return true; return found;
} }
EXPORT_SYMBOL_GPL(nf_osf_find); EXPORT_SYMBOL_GPL(nf_osf_find);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册