linux-stable/fs/ext2
Al Viro 84b35f6efc ext2: unbugger ext2_empty_dir()
commit 27e714c007 upstream.

In 27cfa25895 "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: 27cfa25895 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-07 11:15:46 +01:00
..
Kconfig ext2: use iomap_fiemap to implement ->fiemap 2021-07-27 11:00:32 +02:00
Makefile
acl.c vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
acl.h vfs: add rcu argument to ->get_acl() callback 2021-08-18 22:08:24 +02:00
balloc.c ext2: fix sleeping in atomic bugs on error 2021-09-22 13:05:23 +02:00
dir.c ext2: unbugger ext2_empty_dir() 2023-01-07 11:15:46 +01:00
ext2.h ext2: remove nobh support 2022-08-02 12:34:04 -04:00
file.c ext2: Convert to using invalidate_lock 2021-07-13 14:29:00 +02:00
ialloc.c remove bdi_congested() and wb_congested() and related functions 2022-03-22 15:57:01 -07:00
inode.c Folio changes for 6.0 2022-08-03 10:35:43 -07:00
ioctl.c ext2: convert to fileattr 2021-04-12 15:04:29 +02:00
namei.c ext2: remove nobh support 2022-08-02 12:34:04 -04:00
super.c ext2: Use kvmalloc() for group descriptor array 2022-10-21 12:39:25 +02:00
symlink.c ext2: code cleanup by removing ifdef macro surrounding 2020-05-22 15:11:00 +02:00
xattr.c ext2: avoid deleting xattr block that is being reused 2022-08-02 23:56:25 -04:00
xattr.h ext2: code cleanup by removing ifdef macro surrounding 2020-05-22 15:11:00 +02:00
xattr_security.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr_trusted.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00
xattr_user.c acl: handle idmapped mounts 2021-01-24 14:27:17 +01:00