{
        return cmp_ptr(a, b);
 }
+
+static int unix_state_lock_cmp_fn(const struct lockdep_map *_a,
+                                 const struct lockdep_map *_b)
+{
+       const struct unix_sock *a, *b;
+
+       a = container_of(_a, struct unix_sock, lock.dep_map);
+       b = container_of(_b, struct unix_sock, lock.dep_map);
+
+       /* unix_state_double_lock(): ascending address order. */
+       return cmp_ptr(a, b);
+}
 #endif
 
 static unsigned int unix_unbound_hash(struct sock *sk)
        u->path.dentry = NULL;
        u->path.mnt = NULL;
        spin_lock_init(&u->lock);
+       lock_set_cmp_fn(&u->lock, unix_state_lock_cmp_fn, NULL);
        mutex_init(&u->iolock); /* single task reading lock */
        mutex_init(&u->bindlock); /* single task binding lock */
        init_waitqueue_head(&u->peer_wait);
                unix_state_lock(sk1);
                return;
        }
+
        if (sk1 > sk2)
                swap(sk1, sk2);
 
        unix_state_lock(sk1);
-       unix_state_lock_nested(sk2, U_LOCK_SECOND);
+       unix_state_lock(sk2);
 }
 
 static void unix_state_double_unlock(struct sock *sk1, struct sock *sk2)