mm: fix error case in mlock downgrade reversion
authorHugh Dickins <hugh@veritas.com>
Sun, 8 Feb 2009 20:56:58 +0000 (20:56 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 8 Feb 2009 21:53:28 +0000 (13:53 -0800)
Commit 27421e211a39784694b597dbf35848b88363c248, Manually revert
"mlock: downgrade mmap sem while populating mlocked regions", has
introduced its own regression: __mlock_vma_pages_range() may report
an error (for example, -EFAULT from trying to lock down pages from
beyond EOF), but mlock_vma_pages_range() must hide that from its
callers as before.

Reported-by: Sami Farin <safari-kernel@safari.iki.fi>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mlock.c

index 028ec482fdd44488db7b562358770c80ea60f49b..037161d61b4e72432d9d6bae71507d251b522afc 100644 (file)
@@ -311,7 +311,10 @@ long mlock_vma_pages_range(struct vm_area_struct *vma,
                        is_vm_hugetlb_page(vma) ||
                        vma == get_gate_vma(current))) {
 
-               return __mlock_vma_pages_range(vma, start, end, 1);
+               __mlock_vma_pages_range(vma, start, end, 1);
+
+               /* Hide errors from mmap() and other callers */
+               return 0;
        }
 
        /*