diff options
-rw-r--r-- | net/sctp/socket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index a0e879bb202d..fd7ed9d46a48 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -5773,7 +5773,7 @@ int sctp_inet_listen(struct socket *sock, int backlog) | |||
5773 | goto out; | 5773 | goto out; |
5774 | 5774 | ||
5775 | /* Allocate HMAC for generating cookie. */ | 5775 | /* Allocate HMAC for generating cookie. */ |
5776 | if (sctp_hmac_alg) { | 5776 | if (!sctp_sk(sk)->hmac && sctp_hmac_alg) { |
5777 | tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC); | 5777 | tfm = crypto_alloc_hash(sctp_hmac_alg, 0, CRYPTO_ALG_ASYNC); |
5778 | if (IS_ERR(tfm)) { | 5778 | if (IS_ERR(tfm)) { |
5779 | if (net_ratelimit()) { | 5779 | if (net_ratelimit()) { |
@@ -5801,7 +5801,8 @@ int sctp_inet_listen(struct socket *sock, int backlog) | |||
5801 | goto cleanup; | 5801 | goto cleanup; |
5802 | 5802 | ||
5803 | /* Store away the transform reference. */ | 5803 | /* Store away the transform reference. */ |
5804 | sctp_sk(sk)->hmac = tfm; | 5804 | if (!sctp_sk(sk)->hmac) |
5805 | sctp_sk(sk)->hmac = tfm; | ||
5805 | out: | 5806 | out: |
5806 | sctp_release_sock(sk); | 5807 | sctp_release_sock(sk); |
5807 | return err; | 5808 | return err; |