Skip to contentSkip to conversation

FAILED: patch "[PATCH] cifs: don't leak -ENOMEM in smb2_open_file()" failed to apply to 6.0-stable tree

PATCH [email protected] 1 participant 1 message Dec 28, 2022 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.0-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Possible dependencies:

f60ffa662d14 ("cifs: don't leak -ENOMEM in smb2_open_file()") a9e17d3d74d1 ("cifs: fix static checker warning") 76894f3e2f71 ("cifs: improve symlink handling for smb2+")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From f60ffa662d1427cfd31fe9d895c3566ac50bfe52 Mon Sep 17 00:00:00 2001
From: Paulo Alcantara <[email protected]>
Date: Mon, 19 Dec 2022 10:21:50 -0300
Subject: [PATCH] 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 76894f3e2f71 ("cifs: improve symlink handling for smb2+")
fs/cifs/smb2file.c +2 -2
index ffbd9a99fc12..ba6cc50af390 100644
@@ -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) {