From: Michael S. Tsirkin Date: Tue, 23 Feb 2010 09:25:23 +0000 (+0200) Subject: vhost: fix get_user_pages_fast error handling X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d6db3f5c11dc7ed5712d5d5682aa34025ee5248e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git vhost: fix get_user_pages_fast error handling get_user_pages_fast returns number of pages on success, negative value on failure, but never 0. Fix vhost code to match this logic. Reviewed-by: Juan Quintela Signed-off-by: Michael S. Tsirkin --- diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 6c31c0c9bbb9..7cd55e078794 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);