提交 bae4c0c1 编写于 作者: K Khaled ROMDHANI 提交者: Steve French

fs/cifs: Fix resource leak

The -EIO error return path is leaking memory allocated
to page. Fix this by moving the allocation block after
the check of cifs_forced_shutdown.

Addresses-Coverity: ("Resource leak")
Fixes: 087f757b ("cifs: add shutdown support")
Signed-off-by: NKhaled ROMDHANI <khaledromdhani216@gmail.com>
Reviewed-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NSteve French <stfrench@microsoft.com>
上级 78c09634
......@@ -683,12 +683,16 @@ cifs_symlink(struct user_namespace *mnt_userns, struct inode *inode,
struct tcon_link *tlink;
struct cifs_tcon *pTcon;
const char *full_path;
void *page = alloc_dentry_path();
void *page;
struct inode *newinode = NULL;
if (unlikely(cifs_forced_shutdown(cifs_sb)))
return -EIO;
page = alloc_dentry_path();
if (!page)
return -ENOMEM;
xid = get_xid();
tlink = cifs_sb_tlink(cifs_sb);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册