Unverified Commit 86ef346b authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!1353 ubifs mainline bugfix patch backport

Merge Pull Request from: @ci-robot 
 
PR sync from: ZhaoLong Wang <wangzhaolong1@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/LE7NH4UEHIINC2ABJ5RVIXMUW3B7UFXP/ 
ISSUE: https://gitee.com/openeuler/kernel/issues/I7JO0G

1. ubifs: Fix memory leak in do_rename
2. ubifs: Free memory for tmpfile name

Mårten Lindahl (2):
  ubifs: Free memory for tmpfile name
  ubifs: Fix memory leak in do_rename


-- 
2.31.1
 
 
Link:https://gitee.com/openeuler/kernel/pulls/1353

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 0fc61ff0 6bc63230
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -357,7 +357,6 @@ static struct inode *create_whiteout(struct inode *dir, struct dentry *dentry)
	umode_t mode = S_IFCHR | WHITEOUT_MODE;
	struct inode *inode;
	struct ubifs_info *c = dir->i_sb->s_fs_info;
	struct fscrypt_name nm;

	/*
	 * Create an inode('nlink = 1') for whiteout without updating journal,
@@ -368,10 +367,6 @@ static struct inode *create_whiteout(struct inode *dir, struct dentry *dentry)
	dbg_gen("dent '%pd', mode %#hx in dir ino %lu",
		dentry, mode, dir->i_ino);

	err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm);
	if (err)
		return ERR_PTR(err);

	inode = ubifs_new_inode(c, dir, mode, false);
	if (IS_ERR(inode)) {
		err = PTR_ERR(inode);
@@ -394,7 +389,6 @@ static struct inode *create_whiteout(struct inode *dir, struct dentry *dentry)
	make_bad_inode(inode);
	iput(inode);
out_free:
	fscrypt_free_filename(&nm);
	ubifs_err(c, "cannot create whiteout file, error %d", err);
	return ERR_PTR(err);
}
@@ -490,6 +484,7 @@ static int ubifs_tmpfile(struct inode *dir, struct dentry *dentry,
	unlock_2_inodes(dir, inode);

	ubifs_release_budget(c, &req);
	fscrypt_free_filename(&nm);

	return 0;