linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: correct error handling of ext4_get_journal_inode()
@ 2023-08-26  1:10 Zhang Yi
  2023-08-27 15:27 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Zhang Yi @ 2023-08-26  1:10 UTC (permalink / raw)
  To: linux-ext4
  Cc: tytso, adilger.kernel, jack, yi.zhang, yi.zhang, chengzhihao1,
	yukuai3

From: Zhang Yi <yi.zhang@huawei.com>

Commit '99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error
value")' changed ext4_get_journal_inode() to return error return value
when something bad happened, but missed to modify the caller
ext4_calculate_overhead(), so fix it.

Reported-by: syzbot+b3123e6d9842e526de39@syzkaller.appspotmail.com
Fixes: 99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error value")
Signed-off-by: Zhang Yi <yi.zhang@huawei.com>
---
 fs/ext4/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index bb42525de8d0..91f20afa1d71 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4260,7 +4260,7 @@ int ext4_calculate_overhead(struct super_block *sb)
 	else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) {
 		/* j_inum for internal journal is non-zero */
 		j_inode = ext4_get_journal_inode(sb, j_inum);
-		if (j_inode) {
+		if (!IS_ERR(j_inode)) {
 			j_blocks = j_inode->i_size >> sb->s_blocksize_bits;
 			overhead += EXT4_NUM_B2C(sbi, j_blocks);
 			iput(j_inode);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: correct error handling of ext4_get_journal_inode()
  2023-08-26  1:10 [PATCH] ext4: correct error handling of ext4_get_journal_inode() Zhang Yi
@ 2023-08-27 15:27 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2023-08-27 15:27 UTC (permalink / raw)
  To: Zhang Yi
  Cc: linux-ext4, adilger.kernel, jack, yi.zhang, chengzhihao1, yukuai3

On Sat, Aug 26, 2023 at 09:10:29AM +0800, Zhang Yi wrote:
> From: Zhang Yi <yi.zhang@huawei.com>
> 
> Commit '99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error
> value")' changed ext4_get_journal_inode() to return error return value
> when something bad happened, but missed to modify the caller
> ext4_calculate_overhead(), so fix it.
> 
> Reported-by: syzbot+b3123e6d9842e526de39@syzkaller.appspotmail.com
> Fixes: 99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error value")
> Signed-off-by: Zhang Yi <yi.zhang@huawei.com>

Thanks, I've folded this into the commit "ext4: ext4_get_{dev}_journal
return proper error value".

						- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-27 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-26  1:10 [PATCH] ext4: correct error handling of ext4_get_journal_inode() Zhang Yi
2023-08-27 15:27 ` 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).