diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-05-24 07:40:05 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2013-05-24 14:08:28 -0400 |
commit | 37d4f99b55d46d9f71f4769faf74c95adb2c1daf (patch) | |
tree | 9fd856f6ed71e2dc93409aa32ecbe98ce7793056 /fs/cifs | |
parent | 539673fff76af73c3aee96e0de10edcc97d84db3 (diff) |
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: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 0a7fdc31f253..5b97e56ddbca 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1258,14 +1258,18 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1258 | vol->backupuid_specified = false; /* no backup intent for a user */ | 1258 | vol->backupuid_specified = false; /* no backup intent for a user */ |
1259 | vol->backupgid_specified = false; /* no backup intent for a group */ | 1259 | vol->backupgid_specified = false; /* no backup intent for a group */ |
1260 | 1260 | ||
1261 | /* | 1261 | switch (cifs_parse_devname(devname, vol)) { |
1262 | * For now, we ignore -EINVAL errors under the assumption that the | 1262 | case 0: |
1263 | * unc= and prefixpath= options will be usable. | 1263 | break; |
1264 | */ | 1264 | case -ENOMEM: |
1265 | if (cifs_parse_devname(devname, vol) == -ENOMEM) { | 1265 | cifs_dbg(VFS, "Unable to allocate memory for devname.\n"); |
1266 | printk(KERN_ERR "CIFS: Unable to allocate memory to parse " | 1266 | goto cifs_parse_mount_err; |
1267 | "device string.\n"); | 1267 | case -EINVAL: |
1268 | goto out_nomem; | 1268 | cifs_dbg(VFS, "Malformed UNC in devname.\n"); |
1269 | goto cifs_parse_mount_err; | ||
1270 | default: | ||
1271 | cifs_dbg(VFS, "Unknown error parsing devname.\n"); | ||
1272 | goto cifs_parse_mount_err; | ||
1269 | } | 1273 | } |
1270 | 1274 | ||
1271 | while ((data = strsep(&options, separator)) != NULL) { | 1275 | while ((data = strsep(&options, separator)) != NULL) { |
@@ -1827,7 +1831,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, | |||
1827 | } | 1831 | } |
1828 | #endif | 1832 | #endif |
1829 | if (!vol->UNC) { | 1833 | if (!vol->UNC) { |
1830 | cifs_dbg(VFS, "CIFS mount error: No usable UNC path provided in device string or in unc= option!\n"); | 1834 | cifs_dbg(VFS, "CIFS mount error: No usable UNC path provided in device string!\n"); |
1831 | goto cifs_parse_mount_err; | 1835 | goto cifs_parse_mount_err; |
1832 | } | 1836 | } |
1833 | 1837 | ||