Commit d32fc1e2 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: SO_TIMESTAMP fix from sparc64

parent 63ffe4d6
...@@ -2756,10 +2756,27 @@ static void cmsg32_recvmsg_fixup(struct msghdr *kmsg, unsigned long orig_cmsg_up ...@@ -2756,10 +2756,27 @@ static void cmsg32_recvmsg_fixup(struct msghdr *kmsg, unsigned long orig_cmsg_up
__get_user(kcmsg32->cmsg_type, &ucmsg->cmsg_type); __get_user(kcmsg32->cmsg_type, &ucmsg->cmsg_type);
clen64 = kcmsg32->cmsg_len; clen64 = kcmsg32->cmsg_len;
copy_from_user(CMSG32_DATA(kcmsg32), CMSG_DATA(ucmsg), if (kcmsg32->cmsg_level == SOL_SOCKET &&
clen64 - CMSG_ALIGN(sizeof(*ucmsg))); kcmsg32->cmsg_type == SO_TIMESTAMP) {
clen32 = ((clen64 - CMSG_ALIGN(sizeof(*ucmsg))) + struct timeval tv;
CMSG32_ALIGN(sizeof(struct cmsghdr32))); struct compat_timeval *tv32;
if (clen64 != CMSG_LEN(sizeof(struct timeval))) {
kfree(workbuf);
goto fail;
}
copy_from_user(&tv, CMSG_DATA(ucmsg), sizeof(tv));
tv32 = (struct compat_timeval *) CMSG32_DATA(kcmsg32);
tv32->tv_sec = tv.tv_sec;
tv32->tv_usec = tv.tv_usec;
clen32 = sizeof(*tv32) +
CMSG32_ALIGN(sizeof(struct cmsghdr32));
} else {
copy_from_user(CMSG32_DATA(kcmsg32), CMSG_DATA(ucmsg),
clen64 - CMSG_ALIGN(sizeof(*ucmsg)));
clen32 = ((clen64 - CMSG_ALIGN(sizeof(*ucmsg))) +
CMSG32_ALIGN(sizeof(struct cmsghdr32)));
}
kcmsg32->cmsg_len = clen32; kcmsg32->cmsg_len = clen32;
switch (kcmsg32->cmsg_type) { switch (kcmsg32->cmsg_type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment