Unverified Commit 518cee10 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12800 cachefiles: fix dentry leak in cachefiles_open_file()

parents cfa61250 7ad13063
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -594,14 +594,12 @@ static bool cachefiles_open_file(struct cachefiles_object *object,
	 * write and readdir but not lookup or open).
	 */
	touch_atime(&file->f_path);
	dput(dentry);
	return true;

check_failed:
	fscache_cookie_lookup_negative(object->cookie);
	cachefiles_unmark_inode_in_use(object, file);
	fput(file);
	dput(dentry);
	if (ret == -ESTALE)
		return cachefiles_create_file(object);
	return false;
@@ -610,7 +608,6 @@ static bool cachefiles_open_file(struct cachefiles_object *object,
	fput(file);
error:
	cachefiles_do_unmark_inode_in_use(object, d_inode(dentry));
	dput(dentry);
	return false;
}

@@ -653,7 +650,9 @@ bool cachefiles_look_up_object(struct cachefiles_object *object)
		goto new_file;
	}

	if (!cachefiles_open_file(object, dentry))
	ret = cachefiles_open_file(object, dentry);
	dput(dentry);
	if (!ret)
		return false;

	_leave(" = t [%lu]", file_inode(object->file)->i_ino);