Commit 37d4f99b authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: fix error handling when calling cifs_parse_devname

When we allowed separate unc= and prefixpath= mount options, we could
ignore EINVAL errors from cifs_parse_devname. Now that they are
deprecated, we need to check for that as well and fail the mount if it's
malformed.

Also fix a later error message that refers to the unc= option.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 539673ff
...@@ -1258,14 +1258,18 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1258,14 +1258,18 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
vol->backupuid_specified = false; /* no backup intent for a user */ vol->backupuid_specified = false; /* no backup intent for a user */
vol->backupgid_specified = false; /* no backup intent for a group */ vol->backupgid_specified = false; /* no backup intent for a group */
/* switch (cifs_parse_devname(devname, vol)) {
* For now, we ignore -EINVAL errors under the assumption that the case 0:
* unc= and prefixpath= options will be usable. break;
*/ case -ENOMEM:
if (cifs_parse_devname(devname, vol) == -ENOMEM) { cifs_dbg(VFS, "Unable to allocate memory for devname.\n");
printk(KERN_ERR "CIFS: Unable to allocate memory to parse " goto cifs_parse_mount_err;
"device string.\n"); case -EINVAL:
goto out_nomem; cifs_dbg(VFS, "Malformed UNC in devname.\n");
goto cifs_parse_mount_err;
default:
cifs_dbg(VFS, "Unknown error parsing devname.\n");
goto cifs_parse_mount_err;
} }
while ((data = strsep(&options, separator)) != NULL) { while ((data = strsep(&options, separator)) != NULL) {
...@@ -1827,7 +1831,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1827,7 +1831,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
} }
#endif #endif
if (!vol->UNC) { if (!vol->UNC) {
cifs_dbg(VFS, "CIFS mount error: No usable UNC path provided in device string or in unc= option!\n"); cifs_dbg(VFS, "CIFS mount error: No usable UNC path provided in device string!\n");
goto cifs_parse_mount_err; goto cifs_parse_mount_err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment