Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339489
b: refs/heads/master
c: 62a1a43
h: refs/heads/master
i:
  339487: a2816f7
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed Dec 11, 2012
1 parent b965346 commit 8e2fb7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 193cdd8a293007d1a1ad252cf66b2dc5b793d2d0
refs/heads/master: 62a1a439e0fdd4ec8a80dc00fcbb9f26b5c34de1
39 changes: 12 additions & 27 deletions trunk/fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1566,29 +1566,15 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
got_ip = true;
break;
case Opt_unc:
string = match_strdup(args);
if (string == NULL)
kfree(vol->UNC);
vol->UNC = match_strdup(args);
if (vol->UNC == NULL)
goto out_nomem;

temp_len = strnlen(string, 300);
if (temp_len == 300) {
printk(KERN_WARNING "CIFS: UNC name too long\n");
goto cifs_parse_mount_err;
}

vol->UNC = kmalloc(temp_len+1, GFP_KERNEL);
if (vol->UNC == NULL) {
printk(KERN_WARNING "CIFS: no memory for UNC\n");
goto cifs_parse_mount_err;
}
strcpy(vol->UNC, string);

if (strncmp(string, "//", 2) == 0) {
vol->UNC[0] = '\\';
vol->UNC[1] = '\\';
} else if (strncmp(string, "\\\\", 2) != 0) {
convert_delimiter(vol->UNC, '\\');
if (vol->UNC[0] != '\\' || vol->UNC[1] != '\\') {
printk(KERN_WARNING "CIFS: UNC Path does not "
"begin with // or \\\\\n");
"begin with // or \\\\\n");
goto cifs_parse_mount_err;
}

Expand Down Expand Up @@ -1813,6 +1799,12 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
goto cifs_parse_mount_err;
}

/* make sure UNC has a share name */
if (!strchr(vol->UNC + 3, '\\')) {
cERROR(1, "Malformed UNC. Unable to find share name.");
goto cifs_parse_mount_err;
}

if (!got_ip) {
/* No ip= option specified? Try to get it from UNC */
if (!cifs_convert_address(dstaddr, &vol->UNC[2],
Expand Down Expand Up @@ -2575,13 +2567,6 @@ cifs_get_tcon(struct cifs_ses *ses, struct smb_vol *volume_info)
}
}

if (strchr(volume_info->UNC + 3, '\\') == NULL
&& strchr(volume_info->UNC + 3, '/') == NULL) {
cERROR(1, "Missing share name");
rc = -ENODEV;
goto out_fail;
}

/*
* BB Do we need to wrap session_mutex around this TCon call and Unix
* SetFS as we do on SessSetup and reconnect?
Expand Down

0 comments on commit 8e2fb7c

Please sign in to comment.