Skip to content

Commit 2f47965

Browse files
ImV4beldavem330
authored andcommitted
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: Hyunwoo Kim <[email protected]> Acked-by: Herbert Xu <[email protected]> Reviewed-by: Sabrina Dubroca <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 20ab843 commit 2f47965

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/key/af_key.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
12611261
const struct sadb_x_nat_t_type* n_type;
12621262
struct xfrm_encap_tmpl *natt;
12631263

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

0 commit comments

Comments
 (0)