Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a6be014e authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim
Browse files

f2fs: fix error path of ->symlink



Now, in ->symlink of f2fs, we kept the fixed invoking order between
f2fs_add_link and page_symlink since we should init node info firstly
in f2fs_add_link, then such node info can be used in page_symlink.

But we didn't fix to release meta info which was done before page_symlink
in our error path, so this will leave us corrupt symlink entry in its
parent's dentry page. Fix this issue by adding f2fs_unlink in the error
path for removing such linking.

Signed-off-by: default avatarChao Yu <chao2.yu@samsung.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 7fee7406
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -410,11 +410,14 @@ static int f2fs_symlink(struct inode *dir, struct dentry *dentry,
	 * If the symlink path is stored into inline_data, there is no
	 * performance regression.
	 */
	if (!err)
	if (!err) {
		filemap_write_and_wait_range(inode->i_mapping, 0, p_len - 1);

		if (IS_DIRSYNC(dir))
			f2fs_sync_fs(sbi->sb, 1);
	} else {
		f2fs_unlink(dir, dentry);
	}

	kfree(sd);
	f2fs_fname_crypto_free_buffer(&disk_link);