Commit 2f479651 authored by Hyunwoo Kim's avatar Hyunwoo Kim Committed by David S. Miller
Browse files

af_key: Fix heap information leak



Since x->encap of pfkey_msg2xfrm_state() is not
initialized to 0, kernel heap data can be leaked.

Fix with kzalloc() to prevent this.

Signed-off-by: default avatarHyunwoo Kim <v4bel@theori.io>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: default avatarSabrina Dubroca <sd@queasysnail.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 20ab8432
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1261,7 +1261,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
		const struct sadb_x_nat_t_type* n_type;
		struct xfrm_encap_tmpl *natt;

		x->encap = kmalloc(sizeof(*x->encap), GFP_KERNEL);
		x->encap = kzalloc(sizeof(*x->encap), GFP_KERNEL);
		if (!x->encap) {
			err = -ENOMEM;
			goto out;