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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Disseldorp <ddiss@xxxxxxx> writes:

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

That was a mistake, actually.  Will fix it in v2.  Thanks!



[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux