From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24F722DCF67 for ; Sun, 17 May 2026 09:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779009784; cv=none; b=oj2AY4M4k4CyCNpvcNvB3wlsRGkrilfL4YXYg8w0E6pCOtGuraqDdWr3kkwlv6dsZ1ebl0D3hzdXcltuYAbW5ZYtXfN6w4XzA5z7xWVrnvsdj7VCxfgiB4pqTAUstwyPhU/GQAvvrT0DxWktMA6glEIBRHE37HAXF+WrGt0ogZ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779009784; c=relaxed/simple; bh=4nksWu0m5kxHNf0/X0U5fvtysZjFrwrOvwoPmJNHSKU=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=emf9OxdJUxV0GG+W/BQgKHq+Bc3vpsNTNoJFgdGIchgLL08OR5dxJf4rXBBEomercuf8vJoXS0MYjMDvop73ZY7ESGsWnvPzaOlzAnxmo1cJA29JCMOC0VYgo1E68Rs6uGs8gVpm/ByxrnvvVX1tf2kH9a7svciNZQKUnnYqRoU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=aTP7OWrQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="aTP7OWrQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9103BC2BCB0; Sun, 17 May 2026 09:23:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779009783; bh=4nksWu0m5kxHNf0/X0U5fvtysZjFrwrOvwoPmJNHSKU=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=aTP7OWrQ6YIlqjMcCZu2BrR4gIeqWaTpESdTjMJs9T4/v91oq/FWb8V50PE3cikD3 Nq9G3DH8FnhTuPIItmpPySCbWFH66FRwlKIbcyJuzr5d50r39XJiC1CH9pRQANmTYm RHR2F11izf5hItFC1kBGKxYQaG5gU1SUtFu3JqljsVTVhzHhQ1+EzeSXqrgDEuB9Hc oJGGMuL1XPYkjDTf1s4hEuhRCZIjS2fub7CqOh3e/BVVhL7uF9S9tsD+zkuTyAVM0Z KocYkTpWMWB4avrCTxMt08Ld9tQHnaAZGV1gTSExBApfQUTpfoPNJ3a23dgp1CQvdR uc9eN0e7+z+TA== Message-ID: <76b19184-4b2e-445f-91a1-2f4cf48a3804@kernel.org> Date: Sun, 17 May 2026 17:22:58 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird 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 To: Deepanshu Kartikey , jaegeuk@kernel.org References: <20260510042336.94751-1-kartikey406@gmail.com> Content-Language: en-US From: Chao Yu In-Reply-To: <20260510042336.94751-1-kartikey406@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Reviewed-by: Chao Yu Thanks,