aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-06-10 17:37:02 -0400
committerSteve French <sfrench@us.ibm.com>2008-06-10 17:37:02 -0400
commit79ee9a8b2d328243488fee8b55bfacc822049a2a (patch)
treef3c2c4f9cb37b3e6ea074f90dc541f994f725a74 /fs/cifs
parentdbdbb87636e882042cbe53d5d4eac94206f8db83 (diff)
[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>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsfs.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 5df93fd6303f..86b4d5f405ae 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -97,9 +97,6 @@ cifs_read_super(struct super_block *sb, void *data,
97{ 97{
98 struct inode *inode; 98 struct inode *inode;
99 struct cifs_sb_info *cifs_sb; 99 struct cifs_sb_info *cifs_sb;
100#ifdef CONFIG_CIFS_DFS_UPCALL
101 int len;
102#endif
103 int rc = 0; 100 int rc = 0;
104 101
105 /* BB should we make this contingent on mount parm? */ 102 /* BB should we make this contingent on mount parm? */
@@ -117,15 +114,17 @@ cifs_read_super(struct super_block *sb, void *data,
117 * complex operation (mount), and in case of fail 114 * complex operation (mount), and in case of fail
118 * just exit instead of doing mount and attempting 115 * just exit instead of doing mount and attempting
119 * undo it if this copy fails?*/ 116 * undo it if this copy fails?*/
120 len = strlen(data); 117 if (data) {
121 cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); 118 int len = strlen(data);
122 if (cifs_sb->mountdata == NULL) { 119 cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL);
123 kfree(sb->s_fs_info); 120 if (cifs_sb->mountdata == NULL) {
124 sb->s_fs_info = NULL; 121 kfree(sb->s_fs_info);
125 return -ENOMEM; 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#endif 128#endif
130 129
131 rc = cifs_mount(sb, cifs_sb, data, devname); 130 rc = cifs_mount(sb, cifs_sb, data, devname);