diff options
author | Hyunwoo Kim <v4bel@theori.io> | 2023-02-09 10:16:48 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-02-13 10:30:14 +0100 |
commit | 2f4796518315ab246638db8feebfcb494212e7ee (patch) | |
tree | 20d28a99237d7c4eb386e9b56f3989d5fc5d757c /net | |
parent | Merge branch 'sk-sk_forward_alloc-fixes' (diff) | |
download | linux-2f4796518315ab246638db8feebfcb494212e7ee.tar.xz linux-2f4796518315ab246638db8feebfcb494212e7ee.zip |
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 <v4bel@theori.io>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/key/af_key.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c index 2bdbcec781cd..a815f5ab4c49 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -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; |