Skip to content

Commit

Permalink
ext2: fix unbalanced kmap()/kunmap()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicolas Pitre authored and Linus Torvalds committed Sep 5, 2009
1 parent ac7ac9f commit 9de6886
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/ext2/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9de6886

Please sign in to comment.