Skip to content

Commit e4b41fb

Browse files
spuiukSteve French
authored andcommitted
Fix UNC parsing on mount
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 <[email protected]> Signed-off-by: Sachin Prabhu <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 1023807 commit e4b41fb

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/cifs/connect.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,13 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
16481648
goto cifs_parse_mount_err;
16491649
}
16501650

1651+
vol->UNC = kmalloc(temp_len+1, GFP_KERNEL);
1652+
if (vol->UNC == NULL) {
1653+
printk(KERN_WARNING "CIFS: no memory for UNC\n");
1654+
goto cifs_parse_mount_err;
1655+
}
1656+
strcpy(vol->UNC, string);
1657+
16511658
if (strncmp(string, "//", 2) == 0) {
16521659
vol->UNC[0] = '\\';
16531660
vol->UNC[1] = '\\';
@@ -1657,13 +1664,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
16571664
goto cifs_parse_mount_err;
16581665
}
16591666

1660-
vol->UNC = kmalloc(temp_len+1, GFP_KERNEL);
1661-
if (vol->UNC == NULL) {
1662-
printk(KERN_WARNING "CIFS: no memory "
1663-
"for UNC\n");
1664-
goto cifs_parse_mount_err;
1665-
}
1666-
strcpy(vol->UNC, string);
16671667
break;
16681668
case Opt_domain:
16691669
string = match_strdup(args);

0 commit comments

Comments
 (0)