aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sctp/auth.c')
-rw-r--r--net/sctp/auth.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index bf812048cf6f..aaa6c121ecce 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -392,13 +392,14 @@ nomem:
392 */ 392 */
393int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp) 393int sctp_auth_asoc_init_active_key(struct sctp_association *asoc, gfp_t gfp)
394{ 394{
395 struct net *net = sock_net(asoc->base.sk);
395 struct sctp_auth_bytes *secret; 396 struct sctp_auth_bytes *secret;
396 struct sctp_shared_key *ep_key; 397 struct sctp_shared_key *ep_key;
397 398
398 /* If we don't support AUTH, or peer is not capable 399 /* If we don't support AUTH, or peer is not capable
399 * we don't need to do anything. 400 * we don't need to do anything.
400 */ 401 */
401 if (!sctp_auth_enable || !asoc->peer.auth_capable) 402 if (!net->sctp.auth_enable || !asoc->peer.auth_capable)
402 return 0; 403 return 0;
403 404
404 /* If the key_id is non-zero and we couldn't find an 405 /* If the key_id is non-zero and we couldn't find an
@@ -445,11 +446,12 @@ struct sctp_shared_key *sctp_auth_get_shkey(
445 */ 446 */
446int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp) 447int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp)
447{ 448{
449 struct net *net = sock_net(ep->base.sk);
448 struct crypto_hash *tfm = NULL; 450 struct crypto_hash *tfm = NULL;
449 __u16 id; 451 __u16 id;
450 452
451 /* if the transforms are already allocted, we are done */ 453 /* if the transforms are already allocted, we are done */
452 if (!sctp_auth_enable) { 454 if (!net->sctp.auth_enable) {
453 ep->auth_hmacs = NULL; 455 ep->auth_hmacs = NULL;
454 return 0; 456 return 0;
455 } 457 }
@@ -674,7 +676,12 @@ static int __sctp_auth_cid(sctp_cid_t chunk, struct sctp_chunks_param *param)
674/* Check if peer requested that this chunk is authenticated */ 676/* Check if peer requested that this chunk is authenticated */
675int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc) 677int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
676{ 678{
677 if (!sctp_auth_enable || !asoc || !asoc->peer.auth_capable) 679 struct net *net;
680 if (!asoc)
681 return 0;
682
683 net = sock_net(asoc->base.sk);
684 if (!net->sctp.auth_enable || !asoc->peer.auth_capable)
678 return 0; 685 return 0;
679 686
680 return __sctp_auth_cid(chunk, asoc->peer.peer_chunks); 687 return __sctp_auth_cid(chunk, asoc->peer.peer_chunks);
@@ -683,7 +690,12 @@ int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
683/* Check if we requested that peer authenticate this chunk. */ 690/* Check if we requested that peer authenticate this chunk. */
684int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc) 691int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc)
685{ 692{
686 if (!sctp_auth_enable || !asoc) 693 struct net *net;
694 if (!asoc)
695 return 0;
696
697 net = sock_net(asoc->base.sk);
698 if (!net->sctp.auth_enable);
687 return 0; 699 return 0;
688 700
689 return __sctp_auth_cid(chunk, 701 return __sctp_auth_cid(chunk,