summaryrefslogtreecommitdiff
path: root/fs/ext2
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2022-11-26 03:17:17 +0000
committerJan Kara <jack@suse.cz>2022-11-28 11:41:43 +0100
commit27e714c007e4ad01837bf0fac5c11913a38d7695 (patch)
treec5ff097eef77b019989d2acb9253957e0d7574c6 /fs/ext2
parent36273e5b4e3a934c6d346c8f0b16b97e018094af (diff)
ext2: unbugger ext2_empty_dir()
In 27cfa258951a "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: stable@vger.kernel.org Fixes: 27cfa258951a ("ext2: fix fs corruption when trying to remove a non-empty directory with IO error") Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 6fa714dbee84..e5cbc27ba459 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -684,7 +684,7 @@ int ext2_empty_dir (struct inode * inode)
page = ext2_get_page(inode, i, 0, &page_addr);
if (IS_ERR(page))
- goto not_empty;
+ return 0;
kaddr = page_addr;
de = (ext2_dirent *)kaddr;