From patchwork Tue Feb 23 16:57:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 81498 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o1NH3AK6022183 for ; Tue, 23 Feb 2010 17:03:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753756Ab0BWRB5 (ORCPT ); Tue, 23 Feb 2010 12:01:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48609 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753688Ab0BWRBz (ORCPT ); Tue, 23 Feb 2010 12:01:55 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1NH1Dfa000642 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 23 Feb 2010 12:01:13 -0500 Received: from redhat.com (vpn2-11-39.ams2.redhat.com [10.36.11.39]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id o1NH19Rf028850; Tue, 23 Feb 2010 12:01:09 -0500 Date: Tue, 23 Feb 2010 18:57:58 +0200 From: "Michael S. Tsirkin" To: Rusty Russell , kvm@vger.kernel.org, virtualization@lists.osdl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, David Miller , markmc@redhat.com, gleb@redhat.com, herbert.xu@redhat.com, quintela@redhat.com, dlaor@redhat.com, avi@redhat.com Subject: [PATCH 3/3] vhost: fix get_user_pages_fast error handling Message-ID: <82ba8c97ce55dd4bf9972ad755961cd14e6a0938.1266943453.git.mst@redhat.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Mutt-Fcc: =sent User-Agent: Mutt/1.5.19 (2009-01-05) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 23 Feb 2010 17:03:10 +0000 (UTC) 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);