Skip to content

Commit 27e714c

Browse files
Al Virojankara
authored andcommitted
ext2: unbugger ext2_empty_dir()
In 27cfa25 "ext2: fix fs corruption when trying to remove a non-empty directory with IO error" a funny thing has happened: - page = ext2_get_page(inode, i, dir_has_error, &page_addr); + page = ext2_get_page(inode, i, 0, &page_addr); - if (IS_ERR(page)) { - dir_has_error = 1; - continue; - } + if (IS_ERR(page)) + goto not_empty; And at not_empty: we hit ext2_put_page(page, page_addr), which does put_page(page). Which, unless I'm very mistaken, should oops immediately when given ERR_PTR(-E...) as page. OK, shit happens, insufficiently tested patches included. But when commit in question describes the fault-injection test that exercised that particular failure exit... Ow. CC: [email protected] Fixes: 27cfa25 ("ext2: fix fs corruption when trying to remove a non-empty directory with IO error") Signed-off-by: Al Viro <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent 36273e5 commit 27e714c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ext2/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ int ext2_empty_dir (struct inode * inode)
684684
page = ext2_get_page(inode, i, 0, &page_addr);
685685

686686
if (IS_ERR(page))
687-
goto not_empty;
687+
return 0;
688688

689689
kaddr = page_addr;
690690
de = (ext2_dirent *)kaddr;

0 commit comments

Comments
 (0)