- nommu-fix-cleanup-handling-in-ramfs_nommu_get_umapped_area.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     NOMMU: Fix cleanup handling in ramfs_nommu_get_umapped_area()
has been removed from the -mm tree.  Its filename was
     nommu-fix-cleanup-handling-in-ramfs_nommu_get_umapped_area.patch

This patch was dropped because it was merged into mainline or a subsystem tree

The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/

------------------------------------------------------
Subject: NOMMU: Fix cleanup handling in ramfs_nommu_get_umapped_area()
From: David Howells <dhowells@xxxxxxxxxx>

Fix cleanup handling in ramfs_nommu_get_umapped_area() by only freeing
the number of pages that find_get_pages() said it had returned (nr)
rather than attempting to free the number of pages we asked for
(lpages) - thus avoiding the situation whereby put_page() may be handed
NULL pointers if find_get_pages() returned fewer pages that were
requested.

Also avoid a warning about nr being uninitialised and the need for an
if-statement in the cleanup path by using appropriate gotos.

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
Cc: Bryan Wu <cooloney@xxxxxxxxxx>
Cc: Graf Yang <graf.yang@xxxxxxxxxx>
Cc: Greg Ungerer <gerg@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/ramfs/file-nommu.c |   21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff -puN fs/ramfs/file-nommu.c~nommu-fix-cleanup-handling-in-ramfs_nommu_get_umapped_area fs/ramfs/file-nommu.c
--- a/fs/ramfs/file-nommu.c~nommu-fix-cleanup-handling-in-ramfs_nommu_get_umapped_area
+++ a/fs/ramfs/file-nommu.c
@@ -262,11 +262,11 @@ unsigned long ramfs_nommu_get_unmapped_a
 	ret = -ENOMEM;
 	pages = kzalloc(lpages * sizeof(struct page *), GFP_KERNEL);
 	if (!pages)
-		goto out;
+		goto out_free;
 
 	nr = find_get_pages(inode->i_mapping, pgoff, lpages, pages);
 	if (nr != lpages)
-		goto out; /* leave if some pages were missing */
+		goto out_free_pages; /* leave if some pages were missing */
 
 	/* check the pages for physical adjacency */
 	ptr = pages;
@@ -274,19 +274,18 @@ unsigned long ramfs_nommu_get_unmapped_a
 	page++;
 	for (loop = lpages; loop > 1; loop--)
 		if (*ptr++ != page++)
-			goto out;
+			goto out_free_pages;
 
 	/* okay - all conditions fulfilled */
 	ret = (unsigned long) page_address(pages[0]);
 
- out:
-	if (pages) {
-		ptr = pages;
-		for (loop = lpages; loop > 0; loop--)
-			put_page(*ptr++);
-		kfree(pages);
-	}
-
+out_free_pages:
+	ptr = pages;
+	for (loop = nr; loop > 0; loop--)
+		put_page(*ptr++);
+out_free:
+	kfree(pages);
+out:
 	return ret;
 }
 
_

Patches currently in -mm which might be from dhowells@xxxxxxxxxx are

origin.patch
linux-next.patch
unaligned-wire-up-trivial-arches-for-new-common-unaligned-header.patch
mutex-subsystem-synchro-test-module.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux