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

David Disseldorp
2021-04-30T23:40:11Z

On Fri, 30 Apr 2021 19:16:21 -0300, Paulo Alcantara wrote:

> 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...

...
> 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?

Cheers, David