diff --git a/linux/af_vsock.c b/linux/af_vsock.c
index cdd9d59..0846eeb 100644
--- a/linux/af_vsock.c
+++ b/linux/af_vsock.c
@@ -3221,7 +3221,7 @@ VSockVmciStreamConnect(struct socket *sock,   // IN
     * a notification of an error.
     */
    timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
    while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
       if (timeout == 0) {
@@ -3244,7 +3244,7 @@ VSockVmciStreamConnect(struct socket *sock,   // IN
          goto outWaitError;
       }
 
-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }
 
    if (sk->compat_sk_err) {
@@ -3256,7 +3256,7 @@ VSockVmciStreamConnect(struct socket *sock,   // IN
    }
 
 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -3316,7 +3316,7 @@ VSockVmciAccept(struct socket *sock,     // IN
     * upon connection establishment.
     */
    timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
 
    while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
           listener->compat_sk_err == 0) {
@@ -3332,7 +3332,7 @@ VSockVmciAccept(struct socket *sock,     // IN
          goto outWait;
       }
 
-      compat_cont_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
    }
 
    if (listener->compat_sk_err) {
@@ -3366,7 +3366,7 @@ VSockVmciAccept(struct socket *sock,     // IN
    }
 
 outWait:
-   compat_finish_wait(listener->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(listener), &wait, TASK_RUNNING);
 out:
    release_sock(listener);
    return err;
@@ -3464,7 +3464,7 @@ VSockVmciPoll(struct file *file,    // IN
    sk = sock->sk;
    vsk = vsock_sk(sk);
 
-   poll_wait(file, sk->compat_sk_sleep, wait);
+   poll_wait(file, compat_sk_sleep(sk), wait);
    mask = 0;
 
    if (sk->compat_sk_err) {
@@ -4104,7 +4104,7 @@ VSockVmciStreamSendmsg(struct kiocb *kiocb,          // UNUSED
       goto out;
    }
 
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
    while (totalWritten < len) {
       Bool sentWrote;
@@ -4141,7 +4141,7 @@ VSockVmciStreamSendmsg(struct kiocb *kiocb,          // UNUSED
             goto outWait;
          }
 
-         compat_cont_prepare_to_wait(sk->compat_sk_sleep,
+         compat_cont_prepare_to_wait(compat_sk_sleep(sk),
                                      &wait, TASK_INTERRUPTIBLE);
       }
 
@@ -4194,7 +4194,7 @@ outWait:
    if (totalWritten > 0) {
       err = totalWritten;
    }
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -4428,7 +4428,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb,          // UNUSED
       goto out;
    }
 
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
    while ((ready = VSockVmciStreamHasData(vsk)) < target &&
           sk->compat_sk_err == 0 &&
@@ -4468,7 +4468,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb,          // UNUSED
          goto outWait;
       }
 
-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }
 
    if (sk->compat_sk_err) {
@@ -4534,7 +4534,7 @@ VSockVmciStreamRecvmsg(struct kiocb *kiocb,          // UNUSED
    err = copied;
 
 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
diff --git a/shared/compat_sock.h b/shared/compat_sock.h
index 6969c0c..ba4d048 100644
--- a/shared/compat_sock.h
+++ b/shared/compat_sock.h
@@ -31,7 +31,7 @@
 # define compat_sk_destruct             destruct
 # define compat_sk_shutdown             shutdown
 # define compat_sk_receive_queue        receive_queue
-# define compat_sk_sleep                sleep
+# define compat_sk_sleep(sk)            sk->sleep
 # define compat_sk_err                  err
 # define compat_sk_state_change         state_change
 # define compat_sk_data_ready           data_ready
@@ -51,7 +51,11 @@
 # define compat_sk_destruct             sk_destruct
 # define compat_sk_shutdown             sk_shutdown
 # define compat_sk_receive_queue        sk_receive_queue
-# define compat_sk_sleep                sk_sleep
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34)
+# define compat_sk_sleep(sk)            sk->sk_sleep
+#else
+# define compat_sk_sleep(sk)            sk_sleep(sk)
+#endif
 # define compat_sk_err                  sk_err
 # define compat_sk_state_change         sk_state_change
 # define compat_sk_data_ready           sk_data_ready
