fsck.f2fs: fix incorrect parent blkaddr when adding lost dots
PATCH 1/1 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.
--- fsck/fsck.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fsck/fsck.c +2 -3
@@ -1311,7 +1311,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);
@@ -1326,7 +1325,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)
@@ -1340,7 +1339,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)
Signature · 8 lines
2.40.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 7 lines · Sheng Yong
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 <[email protected]>
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel