9p: Remove INET dependency
[linux-block.git] / net / compat.c
index 161b7bea1f6204ff9120a0c2347f6105c8975772..6564720f32b7de5a8a1927acda2fc7cb9f4a055b 100644 (file)
@@ -113,7 +113,7 @@ int get_compat_msghdr(struct msghdr *kmsg,
 
 #define CMSG_COMPAT_FIRSTHDR(msg)                      \
        (((msg)->msg_controllen) >= sizeof(struct compat_cmsghdr) ?     \
-        (struct compat_cmsghdr __user *)((msg)->msg_control) :         \
+        (struct compat_cmsghdr __user *)((msg)->msg_control_user) :    \
         (struct compat_cmsghdr __user *)NULL)
 
 #define CMSG_COMPAT_OK(ucmlen, ucmsg, mhdr) \
@@ -126,7 +126,7 @@ static inline struct compat_cmsghdr __user *cmsg_compat_nxthdr(struct msghdr *ms
                struct compat_cmsghdr __user *cmsg, int cmsg_len)
 {
        char __user *ptr = (char __user *)cmsg + CMSG_COMPAT_ALIGN(cmsg_len);
-       if ((unsigned long)(ptr + 1 - (char __user *)msg->msg_control) >
+       if ((unsigned long)(ptr + 1 - (char __user *)msg->msg_control_user) >
                        msg->msg_controllen)
                return NULL;
        return (struct compat_cmsghdr __user *)ptr;
@@ -211,6 +211,7 @@ int cmsghdr_from_user_compat_to_kern(struct msghdr *kmsg, struct sock *sk,
                goto Einval;
 
        /* Ok, looks like we made it.  Hook it up and return success. */
+       kmsg->msg_control_is_user = false;
        kmsg->msg_control = kcmsg_base;
        kmsg->msg_controllen = kcmlen;
        return 0;
@@ -225,7 +226,7 @@ Efault:
 
 int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
 {
-       struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
+       struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control_user;
        struct compat_cmsghdr cmhdr;
        struct old_timeval32 ctv;
        struct old_timespec32 cts[3];
@@ -274,7 +275,7 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
        cmlen = CMSG_COMPAT_SPACE(len);
        if (kmsg->msg_controllen < cmlen)
                cmlen = kmsg->msg_controllen;
-       kmsg->msg_control += cmlen;
+       kmsg->msg_control_user += cmlen;
        kmsg->msg_controllen -= cmlen;
        return 0;
 }
@@ -289,7 +290,7 @@ static int scm_max_fds_compat(struct msghdr *msg)
 void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
 {
        struct compat_cmsghdr __user *cm =
-               (struct compat_cmsghdr __user *)msg->msg_control;
+               (struct compat_cmsghdr __user *)msg->msg_control_user;
        unsigned int o_flags = (msg->msg_flags & MSG_CMSG_CLOEXEC) ? O_CLOEXEC : 0;
        int fdmax = min_t(int, scm_max_fds_compat(msg), scm->fp->count);
        int __user *cmsg_data = CMSG_COMPAT_DATA(cm);
@@ -313,7 +314,7 @@ void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm)
                        cmlen = CMSG_COMPAT_SPACE(i * sizeof(int));
                        if (msg->msg_controllen < cmlen)
                                cmlen = msg->msg_controllen;
-                       msg->msg_control += cmlen;
+                       msg->msg_control_user += cmlen;
                        msg->msg_controllen -= cmlen;
                }
        }