* [bug report] ext4: avoid declaring fs inconsistent due to invalid file handles
@ 2018-12-20 19:14 Dan Carpenter
2019-01-01 3:37 ` [PATCH] ext4: fix special inode number checks in __ext4_iget() Theodore Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2018-12-20 19:14 UTC (permalink / raw)
To: tytso; +Cc: linux-ext4
Hello Theodore Ts'o,
The patch 6e74cde1f494: "ext4: avoid declaring fs inconsistent due to
invalid file handles" from Dec 19, 2018, leads to the following
static checker warning:
fs/ext4/inode.c:4841 __ext4_iget()
warn: bitwise AND condition is false here
fs/ext4/inode.c
4825 struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
4826 ext4_iget_flags flags, const char *function,
4827 unsigned int line)
4828 {
4829 struct ext4_iloc iloc;
4830 struct ext4_inode *raw_inode;
4831 struct ext4_inode_info *ei;
4832 struct inode *inode;
4833 journal_t *journal = EXT4_SB(sb)->s_journal;
4834 long ret;
4835 loff_t size;
4836 int block;
4837 uid_t i_uid;
4838 gid_t i_gid;
4839 projid_t i_projid;
4840
4841 if (((flags & EXT4_IGET_NORMAL) &&
^^^^^^^^^^^^^^^^^^^^^^^^
EXT4_IGET_NORMAL is zero so this condition is never true. Is this
something which will depend on the CONFIG_ options or is it supposed
to be flags == EXT4_IGET_NORMAL? I don't know.
4842 (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)) ||
4843 (ino < EXT4_ROOT_INO) ||
4844 (ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count))) {
4845 if (flags & EXT4_IGET_HANDLE)
4846 return ERR_PTR(-ESTALE);
4847 __ext4_error(sb, function, line,
4848 "inode #%lu: comm %s: iget: illegal inode #",
4849 ino, current->comm);
4850 return ERR_PTR(-EFSCORRUPTED);
4851 }
4852
4853 inode = iget_locked(sb, ino);
4854 if (!inode)
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] ext4: fix special inode number checks in __ext4_iget()
2018-12-20 19:14 [bug report] ext4: avoid declaring fs inconsistent due to invalid file handles Dan Carpenter
@ 2019-01-01 3:37 ` Theodore Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2019-01-01 3:37 UTC (permalink / raw)
To: Ext4 Developers List; +Cc: dan.carpenter, Theodore Ts'o, stable
The check for special (reserved) inode number checks in __ext4_iget()
was broken by commit 8a363970d1dc: ("ext4: avoid declaring fs
inconsistent due to invalid file handles"). This was caused by a
botched reversal of the sense of the flag now known as
EXT4_IGET_SPECIAL (when it was previously named EXT4_IGET_NORMAL).
Fix the logic appropriately.
Fixes: 8a363970d1dc ("ext4: avoid declaring fs inconsistent...")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable@kernel.org
---
fs/ext4/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 165ff331d998..34d7e0703cc6 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4834,7 +4834,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
gid_t i_gid;
projid_t i_projid;
- if (((flags & EXT4_IGET_NORMAL) &&
+ if ((!(flags & EXT4_IGET_SPECIAL) &&
(ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)) ||
(ino < EXT4_ROOT_INO) ||
(ino > le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count))) {
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-01 3:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-20 19:14 [bug report] ext4: avoid declaring fs inconsistent due to invalid file handles Dan Carpenter
2019-01-01 3:37 ` [PATCH] ext4: fix special inode number checks in __ext4_iget() Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).