[SSI] openssi/kernel/cluster/ssi/vproc reopen.c,1.35,1.36
Roger Tsang <[email protected]> Wed, 15 Dec 2010 07:10:26 +0000
| Newsgroups | gmane.linux.cluster.ssic.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc
In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv14913/kernel/cluster/ssi/vproc
Modified Files:
Tag: OPENSSI-FC
reopen.c
Log Message:
- reop_export_path: assert pointer to pathdata is NULL before returning to caller to prevent double kfree().
- reop_export_file: fix memory leak on rmtfb_getsvr_file() error.
Index: reopen.c
===================================================================
RCS file: /cvsroot/ssic-linux/openssi/kernel/cluster/ssi/vproc/reopen.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- reopen.c 5 Mar 2010 06:30:21 -0000 1.35
+++ reopen.c 15 Dec 2010 07:10:24 -0000 1.36
@@ -541,6 +541,7 @@
free_page((unsigned long) path->pathpage);
free_out:
kfree(path);
+ SSI_ASSERT(*pathp == NULL);
goto out;
}
@@ -560,20 +561,21 @@
return;
/* free lock structures if exported */
- if ((path)->lckdata_info.filockdata_list_t_val != NULL) {
- flckp = (struct filockdata *)(path)->lckdata_info.filockdata_list_t_val;
+ flckp = (struct filockdata *)(path)->lckdata_info.filockdata_list_t_val;
+ if (flckp)
kfree(flckp);
- }
/* Free the page we allocated to hold the pathname */
if (path->pathpage) {
- if ((u_long) path->pathpage == ((u_long) path->pathname & PAGE_MASK))
- path->pathname = NULL;
+ if ((u_long) path->pathpage ==
+ ((u_long) path->pathname & PAGE_MASK))
+ path->pathname = NULL; /* prevent kfree */
free_page((unsigned long) path->pathpage);
}
/* JH: Free the pathname if it was not allocated as a page */
- kfree(path->pathname);
+ if (path->pathname)
+ kfree(path->pathname);
kfree(path);
*pathp = NULL;
@@ -1010,10 +1012,11 @@
*fb_datapp = NULL;
- error = -ENOMEM;
fb_datap = (fb_data *) kzmalloc(sizeof(fb_data), GFP_USER);
- if (!fb_datap)
+ if (!fb_datap) {
+ error = -ENOMEM;
goto out;
+ }
error = reop_export_path(file->f_dentry, file->f_vfsmnt, optype,
#ifdef REOP_EXPORT_PATH_SVRNODE
@@ -1082,7 +1085,10 @@
out:
return error;
free_out:
+ if (fb_datap->path)
+ reop_export_path_free(&fb_datap->path);
kfree(fb_datap);
+ SSI_ASSERT(*fb_datapp == NULL);
goto out;
}
------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d