Skip to content

Commit f60ffa6

Browse files
Paulo Alcantarasmfrench
authored andcommitted
cifs: don't leak -ENOMEM in smb2_open_file()
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: 76894f3 ("cifs: improve symlink handling for smb2+") Signed-off-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 7ad54b9 commit f60ffa6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/cifs/smb2file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32
122122
struct smb2_hdr *hdr = err_iov.iov_base;
123123

124124
if (unlikely(!err_iov.iov_base || err_buftype == CIFS_NO_BUFFER))
125-
rc = -ENOMEM;
126-
else if (hdr->Status == STATUS_STOPPED_ON_SYMLINK) {
125+
goto out;
126+
if (hdr->Status == STATUS_STOPPED_ON_SYMLINK) {
127127
rc = smb2_parse_symlink_response(oparms->cifs_sb, &err_iov,
128128
&data->symlink_target);
129129
if (!rc) {

0 commit comments

Comments
 (0)