Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Mar 2011 16:38:10 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r220001 - head/sys/vm
Message-ID:  <201103251638.p2PGcAWa087099@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Mar 25 16:38:10 2011
New Revision: 220001
URL: http://svn.freebsd.org/changeset/base/220001

Log:
  Handle the corner case in vm_fault_quick_hold_pages().
  
  If supplied length is zero, and user address is invalid, function
  might return -1, due to the truncation and rounding of the address.
  The callers interpret the situation as EFAULT. Instead of handling
  the zero length in caller, filter it in vm_fault_quick_hold_pages().
  
  Sponsored by:	The FreeBSD Foundation
  Reviewed by:	alc

Modified:
  head/sys/vm/vm_fault.c

Modified: head/sys/vm/vm_fault.c
==============================================================================
--- head/sys/vm/vm_fault.c	Fri Mar 25 14:01:18 2011	(r220000)
+++ head/sys/vm/vm_fault.c	Fri Mar 25 16:38:10 2011	(r220001)
@@ -1058,6 +1058,8 @@ vm_fault_quick_hold_pages(vm_map_t map, 
 	int count;
 	boolean_t pmap_failed;
 
+	if (len == 0)
+		return (0);
 	end = round_page(addr + len);	
 	addr = trunc_page(addr);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103251638.p2PGcAWa087099>