Skip to content

Commit 559c36c

Browse files
ummakynesFlorian Westphal
authored andcommitted
netfilter: nfnetlink_osf: fix possible bogus match in nf_osf_find()
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 <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent e8d5dfd commit 559c36c

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)