diff options
Diffstat (limited to 'net/ipv6/tcp_ipv6.c')
-rw-r--r-- | net/ipv6/tcp_ipv6.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 147ce499f509..d2170da77e5b 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c | |||
@@ -720,10 +720,9 @@ static int tcp_v6_parse_md5_keys (struct sock *sk, char __user *optval, | |||
720 | tp->md5sig_info = p; | 720 | tp->md5sig_info = p; |
721 | } | 721 | } |
722 | 722 | ||
723 | newkey = kmalloc(cmd.tcpm_keylen, GFP_KERNEL); | 723 | newkey = kmemdup(cmd.tcpm_key, cmd.tcpm_keylen, GFP_KERNEL); |
724 | if (!newkey) | 724 | if (!newkey) |
725 | return -ENOMEM; | 725 | return -ENOMEM; |
726 | memcpy(newkey, cmd.tcpm_key, cmd.tcpm_keylen); | ||
727 | if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_MAPPED) { | 726 | if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_MAPPED) { |
728 | return tcp_v4_md5_do_add(sk, sin6->sin6_addr.s6_addr32[3], | 727 | return tcp_v4_md5_do_add(sk, sin6->sin6_addr.s6_addr32[3], |
729 | newkey, cmd.tcpm_keylen); | 728 | newkey, cmd.tcpm_keylen); |
@@ -1503,12 +1502,10 @@ static struct sock * tcp_v6_syn_recv_sock(struct sock *sk, struct sk_buff *skb, | |||
1503 | * memory, then we end up not copying the key | 1502 | * memory, then we end up not copying the key |
1504 | * across. Shucks. | 1503 | * across. Shucks. |
1505 | */ | 1504 | */ |
1506 | char *newkey = kmalloc(key->keylen, GFP_ATOMIC); | 1505 | char *newkey = kmemdup(key->key, key->keylen, GFP_ATOMIC); |
1507 | if (newkey) { | 1506 | if (newkey != NULL) |
1508 | memcpy(newkey, key->key, key->keylen); | ||
1509 | tcp_v6_md5_do_add(newsk, &inet6_sk(sk)->daddr, | 1507 | tcp_v6_md5_do_add(newsk, &inet6_sk(sk)->daddr, |
1510 | newkey, key->keylen); | 1508 | newkey, key->keylen); |
1511 | } | ||
1512 | } | 1509 | } |
1513 | #endif | 1510 | #endif |
1514 | 1511 | ||