projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d9b94c3
)
ext4: avoid remove directory when directory is corrupted
author
Ye Bin
<yebin10@huawei.com>
Wed, 22 Jun 2022 09:02:23 +0000
(17:02 +0800)
committer
Greg Kroah-Hartman
<gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:40:39 +0000
(11:40 +0200)
[ Upstream commit
b24e77ef1c6d4dbf42749ad4903c97539cc9755a
]
Now if check directoy entry is corrupted, ext4_empty_dir may return true
then directory will be removed when file system mounted with "errors=continue".
In order not to make things worse just return false when directory is corrupted.
Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link:
https://lore.kernel.org/r/20220622090223.682234-1-yebin10@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext4/namei.c
patch
|
blob
|
history
diff --git
a/fs/ext4/namei.c
b/fs/ext4/namei.c
index 5821638cb89377fc4078364a4e49866bfa56162f..7d3ec39121f728a30edaa1c12397ec8da1759609 100644
(file)
--- a/
fs/ext4/namei.c
+++ b/
fs/ext4/namei.c
@@
-3090,11
+3090,8
@@
bool ext4_empty_dir(struct inode *inode)
de = (struct ext4_dir_entry_2 *) (bh->b_data +
(offset & (sb->s_blocksize - 1)));
if (ext4_check_dir_entry(inode, NULL, de, bh,
- bh->b_data, bh->b_size, offset)) {
- offset = (offset | (sb->s_blocksize - 1)) + 1;
- continue;
- }
- if (le32_to_cpu(de->inode)) {
+ bh->b_data, bh->b_size, offset) ||
+ le32_to_cpu(de->inode)) {
brelse(bh);
return false;
}