Skip to content

Commit d8b2f86

Browse files
ummakynessmb49
authored andcommitted
netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find()
BugLink: https://bugs.launchpad.net/bugs/1993203 [ Upstream commit 559c36c ] 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: 22c7652 ("netfilter: nft_osf: Add version option support") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 8a5bff4 commit d8b2f86

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/netfilter/nfnetlink_osf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ bool nf_osf_find(const struct sk_buff *skb,
269269
struct nf_osf_hdr_ctx ctx;
270270
const struct tcphdr *tcp;
271271
struct tcphdr _tcph;
272+
bool found = false;
272273

273274
memset(&ctx, 0, sizeof(ctx));
274275

@@ -283,10 +284,11 @@ bool nf_osf_find(const struct sk_buff *skb,
283284

284285
data->genre = f->genre;
285286
data->version = f->version;
287+
found = true;
286288
break;
287289
}
288290

289-
return true;
291+
return found;
290292
}
291293
EXPORT_SYMBOL_GPL(nf_osf_find);
292294

0 commit comments

Comments
 (0)