From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>,
kvm@vger.kernel.org, virtualization@lists.osdl.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
David Miller <davem@davemloft.net>,
ma
Subject: [PATCH 3/3] vhost: fix get_user_pages_fast error handling
Date: Tue, 23 Feb 2010 18:57:58 +0200 [thread overview]
Message-ID: <82ba8c97ce55dd4bf9972ad755961cd14e6a0938.1266943453.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1266943453.git.mst@redhat.com>
get_user_pages_fast returns number of pages on success, negative value
on failure, but never 0. Fix vhost code to match this logic.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
drivers/vhost/vhost.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index d4f8fdf..d003504 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -646,8 +646,9 @@ static int set_bit_to_user(int nr, void __user *addr)
int bit = nr + (log % PAGE_SIZE) * 8;
int r;
r = get_user_pages_fast(log, 1, 1, &page);
- if (r)
+ if (r < 0)
return r;
+ BUG_ON(r != 1);
base = kmap_atomic(page, KM_USER0);
set_bit(bit, base);
kunmap_atomic(base, KM_USER0);
--
1.7.0.18.g0d53a5
next prev parent reply other threads:[~2010-02-23 16:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 16:57 [PATCH 0/3] vhost: logging fixes Michael S. Tsirkin
2010-02-23 16:57 ` [PATCH 1/3] vhost: logging math fix Michael S. Tsirkin
2010-02-23 19:26 ` Juan Quintela
2010-02-23 16:57 ` [PATCH 2/3] vhost: initialize log eventfd context pointer Michael S. Tsirkin
2010-02-23 19:31 ` Juan Quintela
2010-02-23 16:57 ` Michael S. Tsirkin [this message]
2010-02-23 17:34 ` [PATCH 3/3] vhost: fix get_user_pages_fast error handling Gleb Natapov
2010-02-23 17:32 ` Michael S. Tsirkin
2010-02-23 17:39 ` Gleb Natapov
2010-02-23 17:39 ` Michael S. Tsirkin
2010-02-23 17:43 ` Gleb Natapov
2010-02-23 22:42 ` David Miller
2010-02-24 5:37 ` Michael S. Tsirkin
2010-02-24 7:04 ` David Miller
2010-02-24 7:34 ` Michael S. Tsirkin
2010-02-24 7:41 ` David Miller
2010-02-23 19:56 ` Juan Quintela
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=82ba8c97ce55dd4bf9972ad755961cd14e6a0938.1266943453.git.mst@redhat.com \
--to=mst@redhat.com \
--cc=davem@davemloft.net \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=virtualization@lists.osdl.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;
as well as URLs for NNTP newsgroup(s).