Commit 79ee9a8b2d328243488fee8b55bfacc822049a2a
1 parent
dbdbb87636
Exists in
master
and in
7 other branches
[CIFS] cifs: fix oops on mount when CONFIG_CIFS_DFS_UPCALL is enabled
simple "mount -t cifs //xxx /mnt" oopsed on strlen of options http://kerneloops.org/guilty.php?guilty=cifs_get_sb&version=2.6.25-release&start=16711 \ 68&end=1703935&class=oops Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Showing 1 changed file with 10 additions and 11 deletions Side-by-side Diff
fs/cifs/cifsfs.c
... | ... | @@ -97,9 +97,6 @@ |
97 | 97 | { |
98 | 98 | struct inode *inode; |
99 | 99 | struct cifs_sb_info *cifs_sb; |
100 | -#ifdef CONFIG_CIFS_DFS_UPCALL | |
101 | - int len; | |
102 | -#endif | |
103 | 100 | int rc = 0; |
104 | 101 | |
105 | 102 | /* BB should we make this contingent on mount parm? */ |
106 | 103 | |
... | ... | @@ -117,15 +114,17 @@ |
117 | 114 | * complex operation (mount), and in case of fail |
118 | 115 | * just exit instead of doing mount and attempting |
119 | 116 | * undo it if this copy fails?*/ |
120 | - len = strlen(data); | |
121 | - cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); | |
122 | - if (cifs_sb->mountdata == NULL) { | |
123 | - kfree(sb->s_fs_info); | |
124 | - sb->s_fs_info = NULL; | |
125 | - return -ENOMEM; | |
117 | + if (data) { | |
118 | + int len = strlen(data); | |
119 | + cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); | |
120 | + if (cifs_sb->mountdata == NULL) { | |
121 | + kfree(sb->s_fs_info); | |
122 | + sb->s_fs_info = NULL; | |
123 | + return -ENOMEM; | |
124 | + } | |
125 | + strncpy(cifs_sb->mountdata, data, len + 1); | |
126 | + cifs_sb->mountdata[len] = '\0'; | |
126 | 127 | } |
127 | - strncpy(cifs_sb->mountdata, data, len + 1); | |
128 | - cifs_sb->mountdata[len] = '\0'; | |
129 | 128 | #endif |
130 | 129 | |
131 | 130 | rc = cifs_mount(sb, cifs_sb, data, devname); |