All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Stevens <dlstevens@us.ibm.com>
Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: [PATCH] vhost: fix high 32 bit in FEATURES ioctls
Date: Tue, 22 Dec 2009 13:39:33 +0200	[thread overview]
Message-ID: <20091222113933.GA16103@redhat.com> (raw)

From: David Stevens <dlstevens@us.ibm.com>
Subject: vhost: fix high 32 bit in FEATURES ioctls

VHOST_GET_FEATURES fails to initialize high-order 32 bits
in the returned value, and VHOST_SET_FEATURES fails to check them.
This patch fixes it to use 64 bits throughout.

Signed-off-by: David L Stevens <dlstevens@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

---

Rusty, can you queue this for 2.6.33 as well please?

diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 22d5fef..d6db10c 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -563,7 +563,7 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
 {
 	struct vhost_net *n = f->private_data;
 	void __user *argp = (void __user *)arg;
-	u32 __user *featurep = argp;
+	u64 __user *featurep = argp;
 	struct vhost_vring_file backend;
 	u64 features;
 	int r;
@@ -575,10 +575,9 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl,
 		return vhost_net_set_backend(n, backend.index, backend.fd);
 	case VHOST_GET_FEATURES:
 		features = VHOST_FEATURES;
-		return put_user(features, featurep);
+		return copy_to_user(featurep, &features, sizeof features);
 	case VHOST_SET_FEATURES:
-		r = get_user(features, featurep);
-		/* No features for now */
+		r = copy_from_user(&features, featurep, sizeof features);
 		if (r < 0)
 			return r;
 		if (features & ~VHOST_FEATURES)
-- 
MST

             reply	other threads:[~2009-12-22 11:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-22 11:39 Michael S. Tsirkin [this message]
2009-12-23  6:32 ` [PATCH] vhost: fix high 32 bit in FEATURES ioctls Rusty Russell
2009-12-23  6:32 ` Rusty Russell

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=20091222113933.GA16103@redhat.com \
    --to=mst@redhat.com \
    --cc=dlstevens@us.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.