]> Git Repo - linux.git/commitdiff
cifs: don't leak -ENOMEM in smb2_open_file()
authorPaulo Alcantara <[email protected]>
Mon, 19 Dec 2022 13:21:50 +0000 (10:21 -0300)
committerSteve French <[email protected]>
Mon, 19 Dec 2022 14:04:41 +0000 (08:04 -0600)
A NULL error response might be a valid case where smb2_reconnect()
failed to reconnect the session and tcon due to a disconnected server
prior to issuing the I/O operation, so don't leak -ENOMEM to userspace
on such occasions.

Fixes: 76894f3e2f71 ("cifs: improve symlink handling for smb2+")
Signed-off-by: Paulo Alcantara (SUSE) <[email protected]>
Signed-off-by: Steve French <[email protected]>
fs/cifs/smb2file.c

index ffbd9a99fc128634c6812651f1b9776a9727aeb4..ba6cc50af390f22f2af0a83a1d939afbf9ea00a0 100644 (file)
@@ -122,8 +122,8 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32
                struct smb2_hdr *hdr = err_iov.iov_base;
 
                if (unlikely(!err_iov.iov_base || err_buftype == CIFS_NO_BUFFER))
-                       rc = -ENOMEM;
-               else if (hdr->Status == STATUS_STOPPED_ON_SYMLINK) {
+                       goto out;
+               if (hdr->Status == STATUS_STOPPED_ON_SYMLINK) {
                        rc = smb2_parse_symlink_response(oparms->cifs_sb, &err_iov,
                                                         &data->symlink_target);
                        if (!rc) {
This page took 0.053936 seconds and 4 git commands to generate.