diff options
author | Sachin Prabhu <sprabhu@redhat.com> | 2012-04-04 00:58:56 (GMT) |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2012-04-04 01:46:09 (GMT) |
commit | e4b41fb9dafb9af4fecb602bf73d858ab651eeed (patch) | |
tree | 60f08a6ffab5686bfe4256fa8d4f838a09e2698f /fs/cifs | |
parent | 1023807458b6365e28c66095648e1b66e04a4259 (diff) | |
download | linux-e4b41fb9dafb9af4fecb602bf73d858ab651eeed.tar.xz |
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 <smfrench@gmail.com>
Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/connect.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 0511fdb..d81e933 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -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] = '\\'; @@ -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); |