summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2009-09-05 00:25:37 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-05 13:41:08 -0700
commit9de6886ec6e37f45807266a702bb7621498395ad (patch)
tree39402a2d467a856d0f956015a7ad0772719bf1b6 /fs/ext2
parentac7ac9f2b9bfd9b68a1571d27e4c8bebb4788914 (diff)
ext2: fix unbalanced kmap()/kunmap()
In ext2_rename(), dir_page is acquired through ext2_dotdot(). It is then released through ext2_set_link() but only if old_dir != new_dir. Failing that, the pkmap reference count is never decremented and the page remains pinned forever. Repeat that a couple times with highmem pages and all pkmap slots get exhausted, and every further kmap() calls end up stalling on the pkmap_map_wait queue at which point the whole system comes to a halt. Signed-off-by: Nicolas Pitre <nico@marvell.com> Acked-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/namei.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index e1dedb0f7873..78d9b925fc94 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -362,6 +362,10 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry,
if (dir_de) {
if (old_dir != new_dir)
ext2_set_link(old_inode, dir_de, dir_page, new_dir, 0);
+ else {
+ kunmap(dir_page);
+ page_cache_release(dir_page);
+ }
inode_dec_link_count(old_dir);
}
return 0;