diff options
author | Zhang Xiaoxu <zhangxiaoxu5@huawei.com> | 2022-10-17 17:45:25 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-10-18 19:33:43 +0300 |
commit | 10269f13257d4eb6061d09ccce61666316df9838 (patch) | |
tree | 0847a816afcaede99b1379238c6626d864d5bc76 /fs/cifs/inode.c | |
parent | e909d054bdea75ef1ec48c18c5936affdaecbb2c (diff) | |
download | linux-10269f13257d4eb6061d09ccce61666316df9838.tar.xz |
cifs: Fix xid leak in cifs_get_file_info_unix()
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>
Diffstat (limited to 'fs/cifs/inode.c')
-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 7cf96e581d24..9bde08d44617 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); |