* [PATCH net] net: nft: call ipv6_find_hdr() with explicitly initialized offset
@ 2013-12-20 10:23 Daniel Borkmann
2013-12-20 10:26 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2013-12-20 10:23 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel, Hannes Frederic Sowa
In nft's nft_exthdr_eval() routine we process IPv6 extension header
through invoking ipv6_find_hdr(), but we call it with an uninitialized
offset variable that contains some stack value. In ipv6_find_hdr()
we then test if the value of offset != 0 and call skb_header_pointer()
on that offset in order to map struct ipv6hdr into it. Fix it up by
initializing offset to 0 as it was probably intended to be.
Fixes: 96518518cc41 ("netfilter: add nftables")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
net/netfilter/nft_exthdr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c
index 8e0bb75..55c939f 100644
--- a/net/netfilter/nft_exthdr.c
+++ b/net/netfilter/nft_exthdr.c
@@ -31,7 +31,7 @@ static void nft_exthdr_eval(const struct nft_expr *expr,
{
struct nft_exthdr *priv = nft_expr_priv(expr);
struct nft_data *dest = &data[priv->dreg];
- unsigned int offset;
+ unsigned int offset = 0;
int err;
err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: nft: call ipv6_find_hdr() with explicitly initialized offset
2013-12-20 10:23 [PATCH net] net: nft: call ipv6_find_hdr() with explicitly initialized offset Daniel Borkmann
@ 2013-12-20 10:26 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2013-12-20 10:26 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: netfilter-devel, Hannes Frederic Sowa
On Fri, Dec 20, 2013 at 11:23:15AM +0100, Daniel Borkmann wrote:
> In nft's nft_exthdr_eval() routine we process IPv6 extension header
> through invoking ipv6_find_hdr(), but we call it with an uninitialized
> offset variable that contains some stack value. In ipv6_find_hdr()
> we then test if the value of offset != 0 and call skb_header_pointer()
> on that offset in order to map struct ipv6hdr into it. Fix it up by
> initializing offset to 0 as it was probably intended to be.
good catch, applied. Thanks Daniel.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-20 10:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-20 10:23 [PATCH net] net: nft: call ipv6_find_hdr() with explicitly initialized offset Daniel Borkmann
2013-12-20 10:26 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).