mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git
synced 2024-11-23 01:33:39 +08:00
fsck.f2fs: fix incorrect parent blkaddr when adding lost dots
If dot or dotdot is lost, fsck tries to add a new dentry by f2fs_add_link(). The blkaddr of the directory inode should be passed to it in order to update the dirty inode at the right place. This patch fixes the uninitialized `blkaddr' to avoid corrupting f2fs image. Signed-off-by: Sheng Yong <shengyong@oppo.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
6617d15a66
commit
b7b6cacc34
@ -1340,7 +1340,6 @@ skip_blkcnt_fix:
|
||||
nid, child.dot, child.dotdot);
|
||||
if (c.fix_on) {
|
||||
umode_t mode = le16_to_cpu(node_blk->i.i_mode);
|
||||
block_t blkaddr;
|
||||
|
||||
ret = convert_inline_dentry(sbi, node_blk,
|
||||
&ni->blk_addr);
|
||||
@ -1355,7 +1354,7 @@ skip_blkcnt_fix:
|
||||
ret = f2fs_add_link(sbi, node_blk,
|
||||
(const unsigned char *)name,
|
||||
1, nid, map_de_type(mode),
|
||||
&blkaddr, 0);
|
||||
&ni->blk_addr, 0);
|
||||
FIX_MSG("add missing '%s' dirent in ino: %u, pino: %u, ret:%d",
|
||||
name, nid, child_d->p_ino, ret);
|
||||
if (ret)
|
||||
@ -1369,7 +1368,7 @@ skip_blkcnt_fix:
|
||||
(const unsigned char *)name,
|
||||
2, child_d->p_ino,
|
||||
map_de_type(mode),
|
||||
&blkaddr, 0);
|
||||
&ni->blk_addr, 0);
|
||||
FIX_MSG("add missing '%s' dirent in ino: %u, pino: %u, ret:%d",
|
||||
name, nid, child_d->p_ino, ret);
|
||||
if (ret)
|
||||
|
Loading…
Reference in New Issue
Block a user