提交 e4b41fb9 编写于 作者: S Sachin Prabhu 提交者: Steve French

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: NSteve French <smfrench@gmail.com>
Signed-off-by: NSachin Prabhu <sprabhu@redhat.com>
Signed-off-by: NSteve French <sfrench@us.ibm.com>
上级 10238074
...@@ -1648,6 +1648,13 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1648,6 +1648,13 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
goto cifs_parse_mount_err; 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) { if (strncmp(string, "//", 2) == 0) {
vol->UNC[0] = '\\'; vol->UNC[0] = '\\';
vol->UNC[1] = '\\'; vol->UNC[1] = '\\';
...@@ -1657,13 +1664,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, ...@@ -1657,13 +1664,6 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
goto cifs_parse_mount_err; 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; break;
case Opt_domain: case Opt_domain:
string = match_strdup(args); string = match_strdup(args);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册