Patchwork af_key: initialize xfrm encap_oa

login
register
mail settings
Submitter Timo Teräs
Date Jan. 23, 2009, 12:30 p.m.
Message ID <1232713828-6725-1-git-send-email-timo.teras@iki.fi>
Download mbox | patch
Permalink /patch/20040/
State Accepted
Delegated to: David Miller
Headers show

Comments

Timo Teräs - Jan. 23, 2009, 12:30 p.m.
Currently encap_oa is left uninitialized, so it contains garbage data which
is visible to userland via Netlink. Initialize it by zeroing it out.

Signed-off-by: Timo Teras <timo.teras@iki.fi>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 net/key/af_key.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Herbert Xu - Jan. 23, 2009, 10:11 p.m.
On Fri, Jan 23, 2009 at 02:30:28PM +0200, Timo Teras wrote:
> Currently encap_oa is left uninitialized, so it contains garbage data which
> is visible to userland via Netlink. Initialize it by zeroing it out.
> 
> Signed-off-by: Timo Teras <timo.teras@iki.fi>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>

Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks,
David Miller - Jan. 26, 2009, 4:49 a.m.
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sat, 24 Jan 2009 09:11:38 +1100

> On Fri, Jan 23, 2009 at 02:30:28PM +0200, Timo Teras wrote:
> > Currently encap_oa is left uninitialized, so it contains garbage data which
> > is visible to userland via Netlink. Initialize it by zeroing it out.
> > 
> > Signed-off-by: Timo Teras <timo.teras@iki.fi>
> > Cc: Herbert Xu <herbert@gondor.apana.org.au>
> 
> Acked-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/key/af_key.c b/net/key/af_key.c
index f8bd8df..7dcbde3 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1285,6 +1285,7 @@  static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
 				ext_hdrs[SADB_X_EXT_NAT_T_DPORT-1];
 			natt->encap_dport = n_port->sadb_x_nat_t_port_port;
 		}
+		memset(&natt->encap_oa, 0, sizeof(natt->encap_oa));
 	}
 
 	err = xfrm_init_state(x);