diff options
-rw-r--r-- | net/sctp/sm_make_chunk.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index f17908f5c4f3..9b0e5b0d701a 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2583,6 +2583,8 @@ do_addr_param: | |||
2583 | case SCTP_PARAM_STATE_COOKIE: | 2583 | case SCTP_PARAM_STATE_COOKIE: |
2584 | asoc->peer.cookie_len = | 2584 | asoc->peer.cookie_len = |
2585 | ntohs(param.p->length) - sizeof(struct sctp_paramhdr); | 2585 | ntohs(param.p->length) - sizeof(struct sctp_paramhdr); |
2586 | if (asoc->peer.cookie) | ||
2587 | kfree(asoc->peer.cookie); | ||
2586 | asoc->peer.cookie = kmemdup(param.cookie->body, asoc->peer.cookie_len, gfp); | 2588 | asoc->peer.cookie = kmemdup(param.cookie->body, asoc->peer.cookie_len, gfp); |
2587 | if (!asoc->peer.cookie) | 2589 | if (!asoc->peer.cookie) |
2588 | retval = 0; | 2590 | retval = 0; |
@@ -2647,6 +2649,8 @@ do_addr_param: | |||
2647 | goto fall_through; | 2649 | goto fall_through; |
2648 | 2650 | ||
2649 | /* Save peer's random parameter */ | 2651 | /* Save peer's random parameter */ |
2652 | if (asoc->peer.peer_random) | ||
2653 | kfree(asoc->peer.peer_random); | ||
2650 | asoc->peer.peer_random = kmemdup(param.p, | 2654 | asoc->peer.peer_random = kmemdup(param.p, |
2651 | ntohs(param.p->length), gfp); | 2655 | ntohs(param.p->length), gfp); |
2652 | if (!asoc->peer.peer_random) { | 2656 | if (!asoc->peer.peer_random) { |
@@ -2660,6 +2664,8 @@ do_addr_param: | |||
2660 | goto fall_through; | 2664 | goto fall_through; |
2661 | 2665 | ||
2662 | /* Save peer's HMAC list */ | 2666 | /* Save peer's HMAC list */ |
2667 | if (asoc->peer.peer_hmacs) | ||
2668 | kfree(asoc->peer.peer_hmacs); | ||
2663 | asoc->peer.peer_hmacs = kmemdup(param.p, | 2669 | asoc->peer.peer_hmacs = kmemdup(param.p, |
2664 | ntohs(param.p->length), gfp); | 2670 | ntohs(param.p->length), gfp); |
2665 | if (!asoc->peer.peer_hmacs) { | 2671 | if (!asoc->peer.peer_hmacs) { |
@@ -2675,6 +2681,8 @@ do_addr_param: | |||
2675 | if (!ep->auth_enable) | 2681 | if (!ep->auth_enable) |
2676 | goto fall_through; | 2682 | goto fall_through; |
2677 | 2683 | ||
2684 | if (asoc->peer.peer_chunks) | ||
2685 | kfree(asoc->peer.peer_chunks); | ||
2678 | asoc->peer.peer_chunks = kmemdup(param.p, | 2686 | asoc->peer.peer_chunks = kmemdup(param.p, |
2679 | ntohs(param.p->length), gfp); | 2687 | ntohs(param.p->length), gfp); |
2680 | if (!asoc->peer.peer_chunks) | 2688 | if (!asoc->peer.peer_chunks) |