* @unix_stream_connect:
  *     Check permissions before establishing a Unix domain stream connection
  *     between @sock and @other.
- *     @sock contains the socket structure.
- *     @other contains the peer socket structure.
+ *     @sock contains the sock structure.
+ *     @other contains the peer sock structure.
+ *     @newsk contains the new sock structure.
  *     Return 0 if permission is granted.
  * @unix_may_send:
  *     Check permissions before connecting or sending datagrams from @sock to
        int (*inode_getsecctx)(struct inode *inode, void **ctx, u32 *ctxlen);
 
 #ifdef CONFIG_SECURITY_NETWORK
-       int (*unix_stream_connect) (struct socket *sock,
-                                   struct socket *other, struct sock *newsk);
+       int (*unix_stream_connect) (struct sock *sock, struct sock *other, struct sock *newsk);
        int (*unix_may_send) (struct socket *sock, struct socket *other);
 
        int (*socket_create) (int family, int type, int protocol, int kern);
 
 #ifdef CONFIG_SECURITY_NETWORK
 
-int security_unix_stream_connect(struct socket *sock, struct socket *other,
-                                struct sock *newsk);
+int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk);
 int security_unix_may_send(struct socket *sock,  struct socket *other);
 int security_socket_create(int family, int type, int protocol, int kern);
 int security_socket_post_create(struct socket *sock, int family,
 int security_tun_dev_attach(struct sock *sk);
 
 #else  /* CONFIG_SECURITY_NETWORK */
-static inline int security_unix_stream_connect(struct socket *sock,
-                                              struct socket *other,
+static inline int security_unix_stream_connect(struct sock *sock,
+                                              struct sock *other,
                                               struct sock *newsk)
 {
        return 0;
 
                goto restart;
        }
 
-       err = security_unix_stream_connect(sock, other->sk_socket, newsk);
+       err = security_unix_stream_connect(sk, other, newsk);
        if (err) {
                unix_state_unlock(sk);
                goto out_unlock;
 
 }
 
 #ifdef CONFIG_SECURITY_NETWORK
-static int cap_unix_stream_connect(struct socket *sock, struct socket *other,
+static int cap_unix_stream_connect(struct sock *sock, struct sock *other,
                                   struct sock *newsk)
 {
        return 0;
 
 
 #ifdef CONFIG_SECURITY_NETWORK
 
-int security_unix_stream_connect(struct socket *sock, struct socket *other,
-                                struct sock *newsk)
+int security_unix_stream_connect(struct sock *sock, struct sock *other, struct sock *newsk)
 {
        return security_ops->unix_stream_connect(sock, other, newsk);
 }
 
        return sock_has_perm(current, sock->sk, SOCKET__SHUTDOWN);
 }
 
-static int selinux_socket_unix_stream_connect(struct socket *sock,
-                                             struct socket *other,
+static int selinux_socket_unix_stream_connect(struct sock *sock,
+                                             struct sock *other,
                                              struct sock *newsk)
 {
-       struct sk_security_struct *sksec_sock = sock->sk->sk_security;
-       struct sk_security_struct *sksec_other = other->sk->sk_security;
+       struct sk_security_struct *sksec_sock = sock->sk_security;
+       struct sk_security_struct *sksec_other = other->sk_security;
        struct sk_security_struct *sksec_new = newsk->sk_security;
        struct common_audit_data ad;
        int err;
 
        COMMON_AUDIT_DATA_INIT(&ad, NET);
-       ad.u.net.sk = other->sk;
+       ad.u.net.sk = other;
 
        err = avc_has_perm(sksec_sock->sid, sksec_other->sid,
                           sksec_other->sclass,
 
 
 /**
  * smack_unix_stream_connect - Smack access on UDS
- * @sock: one socket
- * @other: the other socket
+ * @sock: one sock
+ * @other: the other sock
  * @newsk: unused
  *
  * Return 0 if a subject with the smack of sock could access
  * an object with the smack of other, otherwise an error code
  */
-static int smack_unix_stream_connect(struct socket *sock,
-                                    struct socket *other, struct sock *newsk)
+static int smack_unix_stream_connect(struct sock *sock,
+                                    struct sock *other, struct sock *newsk)
 {
-       struct inode *sp = SOCK_INODE(sock);
-       struct inode *op = SOCK_INODE(other);
+       struct inode *sp = SOCK_INODE(sock->sk_socket);
+       struct inode *op = SOCK_INODE(other->sk_socket);
        struct smk_audit_info ad;
 
        smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET);
-       smk_ad_setfield_u_net_sk(&ad, other->sk);
+       smk_ad_setfield_u_net_sk(&ad, other);
        return smk_access(smk_of_inode(sp), smk_of_inode(op),
                                 MAY_READWRITE, &ad);
 }