Netdev List
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org,
	Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 1/1] net: compat_sys_recvmmsg user timespec arg can be NULL
Date: Tue,  1 Dec 2009 15:52:16 -0200	[thread overview]
Message-ID: <1259689936-27570-1-git-send-email-acme@infradead.org> (raw)

From: Jean-Mickael Guerin <jean-mickael.guerin@6wind.com>

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 <jean-mickael.guerin@6wind.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 net/compat.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/net/compat.c b/net/compat.c
index 6a2f75f..e1a56ad 100644
--- a/net/compat.c
+++ b/net/compat.c
@@ -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;
-- 
1.6.2.5


             reply	other threads:[~2009-12-01 17:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01 17:52 Arnaldo Carvalho de Melo [this message]
2009-12-02  9:23 ` [PATCH 1/1] net: compat_sys_recvmmsg user timespec arg can be NULL David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1259689936-27570-1-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=davem@davemloft.net \
    --cc=jean-mickael.guerin@6wind.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox