diff options
author | Zhang Xiaoxu <zhangxiaoxu5@huawei.com> | 2022-10-17 22:45:25 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-12-31 13:26:54 +0100 |
commit | 4d99a4c674811d2a9a48644cfb7b82110def7df0 (patch) | |
tree | 80d22b7d23562de6e811519609dd45a8ae2f2a55 | |
parent | 983ec6379b9bab7bf790aa7df5dc3a461ebad72a (diff) |
cifs: Fix xid leak in cifs_get_file_info_unix()
commit 10269f13257d4eb6061d09ccce61666316df9838 upstream.
If stardup the symlink target failed, should free the xid,
otherwise the xid will be leaked.
Fixes: 76894f3e2f71 ("cifs: improve symlink handling for smb2+")
Reviewed-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/cifs/inode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index c1ea821899f8..60daa6fffce5 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -368,8 +368,10 @@ cifs_get_file_info_unix(struct file *filp) if (cfile->symlink_target) { fattr.cf_symlink_target = kstrdup(cfile->symlink_target, GFP_KERNEL); - if (!fattr.cf_symlink_target) - return -ENOMEM; + if (!fattr.cf_symlink_target) { + rc = -ENOMEM; + goto cifs_gfiunix_out; + } } rc = CIFSSMBUnixQFileInfo(xid, tcon, cfile->fid.netfid, &find_data); |