Thread (7 messages) 7 messages, 3 authors, 2021-05-04

Re: [PATCH] cifs: fix regression when mounting shares with prefix paths

From: Paulo Alcantara <hidden>
Date: 2021-05-03 12:41:16
Also in: linux-cifs

David Disseldorp [off-list ref] writes:
On Fri, 30 Apr 2021 19:16:21 -0300, Paulo Alcantara wrote:
quoted
The commit 315db9a05b7a ("cifs: fix leak in cifs_smb3_do_mount() ctx")
revealed an existing bug when mounting shares that contain a prefix
path or DFS links.
Sorry for the mess. One question...

...
quoted
 	if (mntopts) {
 		char *ip;
 
-		cifs_dbg(FYI, "%s: mntopts=%s\n", __func__, mntopts);
 		rc = smb3_parse_opt(mntopts, "ip", &ip);
-		if (!rc && !cifs_convert_address((struct sockaddr *)&ctx->dstaddr, ip,
-						 strlen(ip))) {
-			cifs_dbg(VFS, "%s: failed to convert ip address\n", __func__);
-			return -EINVAL;
+		if (!rc) {
+			rc = cifs_convert_address((struct sockaddr *)&ctx->dstaddr, ip, strlen(ip));
+			kfree(ip);
+			if (!rc) {
+				cifs_dbg(VFS, "%s: failed to convert ip address\n", __func__);
+				return -EINVAL;
+			}
 		}
 	}
 
@@ -3189,7 +3198,7 @@ cifs_setup_volume_info(struct smb3_fs_context *ctx, const char *mntopts, const c
 		return -EINVAL;
 	}
 
-	return rc;
+	return 0;
 }
It seems that smb3_parse_opt() errors will no longer be propagated here.
Is that intentional?
That was a mistake, actually.  Will fix it in v2.  Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help