Commit d142cd23 authored by Laszlo Valko's avatar Laszlo Valko Committed by David S. Miller

[SPARC64]: Handle SO_TIMESTAMP properly in compat recvmsg.

parent bb36f487
......@@ -2298,10 +2298,27 @@ static void cmsg32_recvmsg_fixup(struct msghdr *kmsg, unsigned long orig_cmsg_up
__get_user(kcmsg32->cmsg_type, &ucmsg->cmsg_type);
clen64 = kcmsg32->cmsg_len;
if (kcmsg32->cmsg_level == SOL_SOCKET &&
kcmsg32->cmsg_type == SO_TIMESTAMP) {
struct timeval tv;
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;
ucmsg = (struct cmsghdr *) (((char *)ucmsg) + CMSG_ALIGN(clen64));
......
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