[merged] hfs-fix-memory-leak-when-unmounting.patch removed from -mm tree

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

 



The patch titled
     hfs: fix memory leak when unmounting
has been removed from the -mm tree.  Its filename was
     hfs-fix-memory-leak-when-unmounting.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: hfs: fix memory leak when unmounting
From: Dave Anderson <anderson@xxxxxxxxxx>

When an HFS filesystem is unmounted, it leaks a 2-page bitmap.  Also,
under extreme memory pressure, it's possible that hfs_releasepage() may
use a tree pointer that has not been initialized, and if so, the release
request should just be rejected.

[akpm@xxxxxxxxxxxxxxxxxxxx: free_pages(0) is legal, remove obvious comment]
Signed-off-by: Dave Anderson <anderson@xxxxxxxxxx>
Tested-by: Eugene Teo <eugeneteo@xxxxxxxxx>
Cc: Roman Zippel <zippel@xxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 fs/hfs/inode.c |    4 ++++
 fs/hfs/mdb.c   |    1 +
 2 files changed, 5 insertions(+)

diff -puN fs/hfs/inode.c~hfs-fix-memory-leak-when-unmounting fs/hfs/inode.c
--- a/fs/hfs/inode.c~hfs-fix-memory-leak-when-unmounting
+++ a/fs/hfs/inode.c
@@ -70,6 +70,10 @@ static int hfs_releasepage(struct page *
 		BUG();
 		return 0;
 	}
+
+	if (!tree)
+		return 0;
+
 	if (tree->node_size >= PAGE_CACHE_SIZE) {
 		nidx = page->index >> (tree->node_size_shift - PAGE_CACHE_SHIFT);
 		spin_lock(&tree->hash_lock);
diff -puN fs/hfs/mdb.c~hfs-fix-memory-leak-when-unmounting fs/hfs/mdb.c
--- a/fs/hfs/mdb.c~hfs-fix-memory-leak-when-unmounting
+++ a/fs/hfs/mdb.c
@@ -349,6 +349,7 @@ void hfs_mdb_put(struct super_block *sb)
 	if (HFS_SB(sb)->nls_disk)
 		unload_nls(HFS_SB(sb)->nls_disk);
 
+	free_pages((unsigned long)HFS_SB(sb)->bitmap, PAGE_SIZE < 8192 ? 1 : 0);
 	kfree(HFS_SB(sb));
 	sb->s_fs_info = NULL;
 }
_

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

origin.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