@@ -829,7 +829,7 @@ static int apparmor_sk_alloc_security(struct sock *sk, int family, gfp_t flags)
829829 if (!ctx )
830830 return - ENOMEM ;
831831
832- SK_CTX ( sk ) = ctx ;
832+ sk -> sk_security = ctx ;
833833
834834 return 0 ;
835835}
@@ -839,9 +839,9 @@ static int apparmor_sk_alloc_security(struct sock *sk, int family, gfp_t flags)
839839 */
840840static void apparmor_sk_free_security (struct sock * sk )
841841{
842- struct aa_sk_ctx * ctx = SK_CTX (sk );
842+ struct aa_sk_ctx * ctx = aa_sock (sk );
843843
844- SK_CTX ( sk ) = NULL ;
844+ sk -> sk_security = NULL ;
845845 aa_put_label (ctx -> label );
846846 aa_put_label (ctx -> peer );
847847 kfree (ctx );
@@ -853,8 +853,8 @@ static void apparmor_sk_free_security(struct sock *sk)
853853static void apparmor_sk_clone_security (const struct sock * sk ,
854854 struct sock * newsk )
855855{
856- struct aa_sk_ctx * ctx = SK_CTX (sk );
857- struct aa_sk_ctx * new = SK_CTX (newsk );
856+ struct aa_sk_ctx * ctx = aa_sock (sk );
857+ struct aa_sk_ctx * new = aa_sock (newsk );
858858
859859 if (new -> label )
860860 aa_put_label (new -> label );
@@ -907,7 +907,7 @@ static int apparmor_socket_post_create(struct socket *sock, int family,
907907 label = aa_get_current_label ();
908908
909909 if (sock -> sk ) {
910- struct aa_sk_ctx * ctx = SK_CTX (sock -> sk );
910+ struct aa_sk_ctx * ctx = aa_sock (sock -> sk );
911911
912912 aa_put_label (ctx -> label );
913913 ctx -> label = aa_get_label (label );
@@ -1092,7 +1092,7 @@ static int apparmor_socket_shutdown(struct socket *sock, int how)
10921092 */
10931093static int apparmor_socket_sock_rcv_skb (struct sock * sk , struct sk_buff * skb )
10941094{
1095- struct aa_sk_ctx * ctx = SK_CTX (sk );
1095+ struct aa_sk_ctx * ctx = aa_sock (sk );
10961096
10971097 if (!skb -> secmark )
10981098 return 0 ;
@@ -1105,7 +1105,7 @@ static int apparmor_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
11051105
11061106static struct aa_label * sk_peer_label (struct sock * sk )
11071107{
1108- struct aa_sk_ctx * ctx = SK_CTX (sk );
1108+ struct aa_sk_ctx * ctx = aa_sock (sk );
11091109
11101110 if (ctx -> peer )
11111111 return ctx -> peer ;
@@ -1186,7 +1186,7 @@ static int apparmor_socket_getpeersec_dgram(struct socket *sock,
11861186 */
11871187static void apparmor_sock_graft (struct sock * sk , struct socket * parent )
11881188{
1189- struct aa_sk_ctx * ctx = SK_CTX (sk );
1189+ struct aa_sk_ctx * ctx = aa_sock (sk );
11901190
11911191 if (!ctx -> label )
11921192 ctx -> label = aa_get_current_label ();
@@ -1196,7 +1196,7 @@ static void apparmor_sock_graft(struct sock *sk, struct socket *parent)
11961196static int apparmor_inet_conn_request (const struct sock * sk , struct sk_buff * skb ,
11971197 struct request_sock * req )
11981198{
1199- struct aa_sk_ctx * ctx = SK_CTX (sk );
1199+ struct aa_sk_ctx * ctx = aa_sock (sk );
12001200
12011201 if (!skb -> secmark )
12021202 return 0 ;
@@ -1809,7 +1809,7 @@ static unsigned int apparmor_ip_postroute(void *priv,
18091809 if (sk == NULL )
18101810 return NF_ACCEPT ;
18111811
1812- ctx = SK_CTX (sk );
1812+ ctx = aa_sock (sk );
18131813 if (!apparmor_secmark_check (ctx -> label , OP_SENDMSG , AA_MAY_SEND ,
18141814 skb -> secmark , sk ))
18151815 return NF_ACCEPT ;
0 commit comments