cifs: Fix xid leak in cifs_create()

If the cifs already shutdown, we should free the xid before return,
otherwise, the xid will be leaked.

Fixes: 087f757b01 ("cifs: add shutdown support")
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Zhang Xiaoxu 2022-10-17 22:45:21 +08:00 committed by Steve French
parent 9abf2313ad
commit fee0fb1f15

View File

@ -543,8 +543,10 @@ int cifs_create(struct user_namespace *mnt_userns, struct inode *inode,
cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %pd and dentry = 0x%p\n", cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
inode, direntry, direntry); inode, direntry, direntry);
if (unlikely(cifs_forced_shutdown(CIFS_SB(inode->i_sb)))) if (unlikely(cifs_forced_shutdown(CIFS_SB(inode->i_sb)))) {
return -EIO; rc = -EIO;
goto out_free_xid;
}
tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb)); tlink = cifs_sb_tlink(CIFS_SB(inode->i_sb));
rc = PTR_ERR(tlink); rc = PTR_ERR(tlink);