Skip to content

Commit

Permalink
net: compat_sys_recvmmsg user timespec arg can be NULL
Browse files Browse the repository at this point in the history
We must test if user timespec is non-NULL before copying from userpace,
same as sys_recvmmsg().

Commiter note: changed it so that we have just one branch.

Signed-off-by: Jean-Mickael Guerin <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Jean-Mickael Guerin authored and davem330 committed Dec 2, 2009
1 parent d7256d0 commit 5b23136
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -758,9 +758,13 @@ asmlinkage long compat_sys_recvmmsg(int fd, struct compat_mmsghdr __user *mmsg,
{
int datagrams;
struct timespec ktspec;
struct compat_timespec __user *utspec =
(struct compat_timespec __user *)timeout;
struct compat_timespec __user *utspec;

if (timeout == NULL)
return __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
flags | MSG_CMSG_COMPAT, NULL);

utspec = (struct compat_timespec __user *)timeout;
if (get_user(ktspec.tv_sec, &utspec->tv_sec) ||
get_user(ktspec.tv_nsec, &utspec->tv_nsec))
return -EFAULT;
Expand Down

0 comments on commit 5b23136

Please sign in to comment.