mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Deepanshu Kartikey <kartikey406@gmail.com>, jaegeuk@kernel.org
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, stable@kernel.org,
	syzbot+eec8f2693d71386bd600@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] f2fs: initialize ino_entry_info before checkpoint load
Date: Sun, 17 May 2026 17:22:58 +0800	[thread overview]
Message-ID: <76b19184-4b2e-445f-91a1-2f4cf48a3804@kernel.org> (raw)
In-Reply-To: <20260510042336.94751-1-kartikey406@gmail.com>

On 5/10/2026 12:23 PM, Deepanshu Kartikey wrote:
> When f2fs_get_valid_checkpoint() fails during mount (e.g. due to an
> invalid checkpoint CRC on a malformed image), f2fs_fill_super() takes
> an error path that eventually calls iput() on the root inode. This
> invokes f2fs_drop_inode() -> f2fs_exist_written_data(), which acquires
> sbi->im[]->ino_lock. However, f2fs_init_ino_entry_info() has not run
> yet at this point, so the spinlock is uninitialized and lockdep
> complains:
> 
>    F2FS-fs (loop0): invalid crc value
>    F2FS-fs (loop0): Failed to get valid F2FS checkpoint
>    INFO: trying to register non-static key.
>    The code is fine but needs lockdep annotation, or maybe
>    you didn't initialize this object before use?
>    ...
>     f2fs_exist_written_data+0x53/0x90 fs/f2fs/checkpoint.c:787
>     f2fs_drop_inode+0xda/0xbf0 fs/f2fs/super.c:1852
>     iput+0x651/0xe80 fs/inode.c:2009
>     f2fs_fill_super+0x6047/0x7850 fs/f2fs/super.c:5461
> 
> Move f2fs_init_ino_entry_info() to before f2fs_get_valid_checkpoint()
> so that sbi->im[] is always fully initialized before any error path
> can trigger iput() -> f2fs_drop_inode(). The init function only
> depends on raw superblock fields (BLKS_PER_SEG, F2FS_CP_PACKS,
> NR_CURSEG_PERSIST_TYPE, __cp_payload), which are populated well
> before checkpoint load, so the move is safe.
> 
> Fixes: 3063c80776e3 ("f2fs: another way to set large folio by remembering inode number")
> Cc: stable@kernel.org
> Reported-by: syzbot+eec8f2693d71386bd600@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=eec8f2693d71386bd600
> Tested-by: syzbot+eec8f2693d71386bd600@syzkaller.appspotmail.com
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

  parent reply	other threads:[~2026-05-17  9:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10  4:23 Deepanshu Kartikey
2026-05-11  1:41 ` [f2fs-dev] " patchwork-bot+f2fs
2026-05-17  9:22 ` Chao Yu [this message]
2026-06-21  8:18 ` Deepanshu Kartikey
2026-06-22  0:59   ` Chao Yu
2026-06-22 19:52     ` Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=76b19184-4b2e-445f-91a1-2f4cf48a3804@kernel.org \
    --to=chao@kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=kartikey406@gmail.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    --cc=syzbot+eec8f2693d71386bd600@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome