mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
ipv6: fix possible crashes in ip6_cork_release()
[ Upstream commit284041ef21
] commit0178b695fd
("ipv6: Copy cork options in ip6_append_data") added some code duplication and bad error recovery, leading to potential crash in ip6_cork_release() as kfree() could be called with garbage. use kzalloc() to make sure this wont happen. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> Cc: Neal Cardwell <ncardwell@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
c76631940b
commit
32d704a1a1
1 changed files with 1 additions and 1 deletions
|
@ -1236,7 +1236,7 @@ int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to,
|
|||
if (WARN_ON(np->cork.opt))
|
||||
return -EINVAL;
|
||||
|
||||
np->cork.opt = kmalloc(opt->tot_len, sk->sk_allocation);
|
||||
np->cork.opt = kzalloc(opt->tot_len, sk->sk_allocation);
|
||||
if (unlikely(np->cork.opt == NULL))
|
||||
return -ENOBUFS;
|
||||
|
||||
|
|
Loading…
Reference in a new issue