diff options
| author | Siluxsept <ronny.horn.rh@gmail.com> | 2024-02-06 04:37:40 +0100 |
|---|---|---|
| committer | Siluxsept <ronny.horn.rh@gmail.com> | 2024-02-06 04:38:56 +0100 |
| commit | 8e8137ac800bdc27181743ec73d0e90e28b4e8af (patch) | |
| tree | 7e2fbc9d9e305e46414c21d08eeaeb1d56ccb0f0 /net/sctp/auth.c | |
| parent | 9c2f9bfc860f0cd6f2d3320b5f72a0f4adf24b25 (diff) | |
merge branch lineage-20 into t13.0t13.0
https: //github.com/LineageOS/android_kernel_google_redbull
Change-Id: I4a450eb794cc99abf711ad3b5b82946092be84ba
Diffstat (limited to 'net/sctp/auth.c')
| -rw-r--r-- | net/sctp/auth.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 9e0c98df20da..9cf61a18098a 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -886,12 +886,17 @@ int sctp_auth_set_key(struct sctp_endpoint *ep, } list_del_init(&shkey->key_list); - sctp_auth_shkey_release(shkey); list_add(&cur_key->key_list, sh_keys); - if (asoc && asoc->active_key_id == auth_key->sca_keynumber) - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (asoc && asoc->active_key_id == auth_key->sca_keynumber && + sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + list_del_init(&cur_key->key_list); + sctp_auth_shkey_release(cur_key); + list_add(&shkey->key_list, sh_keys); + return -ENOMEM; + } + sctp_auth_shkey_release(shkey); return 0; } @@ -920,8 +925,13 @@ int sctp_auth_set_active_key(struct sctp_endpoint *ep, return -EINVAL; if (asoc) { + __u16 active_key_id = asoc->active_key_id; + asoc->active_key_id = key_id; - sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL); + if (sctp_auth_asoc_init_active_key(asoc, GFP_KERNEL)) { + asoc->active_key_id = active_key_id; + return -ENOMEM; + } } else ep->active_key_id = key_id; |
