Skip to content

Commit

Permalink
Fix UNC parsing on mount
Browse files Browse the repository at this point in the history
The code cleanup of cifs_parse_mount_options resulted in a new bug being
introduced in the parsing of the UNC. This results in vol->UNC being
modified before vol->UNC was allocated.

Reported-by: Steve French <smfrench@gmail.com>
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
  • Loading branch information
Sachin Prabhu authored and Steve French committed Apr 4, 2012
1 parent 1023807 commit e4b41fb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,13 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
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] = '\\';
Expand All @@ -1657,13 +1664,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
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);
break;
case Opt_domain:
string = match_strdup(args);
Expand Down

0 comments on commit e4b41fb

Please sign in to comment.