summaryrefslogtreecommitdiffstats
path: root/fs/ceph/dir.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-04-23 11:36:54 -0700
committerSage Weil <sage@newdream.net>2010-05-17 15:25:23 -0700
commit8c6efb58a5bab880d45b2078cb55ec4320707daf (patch)
treefe4d72552be0525905d569f0efd09938c6175369 /fs/ceph/dir.c
parent559c1e0073ae779d60e1c673cda837f3e4295302 (diff)
ceph: fix memory leak due to possible dentry init race
Free dentry_info in error path. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/dir.c')
-rw-r--r--fs/ceph/dir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 33feac75c53..422794fd10e 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -51,8 +51,11 @@ int ceph_init_dentry(struct dentry *dentry)
return -ENOMEM; /* oh well */
spin_lock(&dentry->d_lock);
- if (dentry->d_fsdata) /* lost a race */
+ if (dentry->d_fsdata) {
+ /* lost a race */
+ kmem_cache_free(ceph_dentry_cachep, di);
goto out_unlock;
+ }
di->dentry = dentry;
di->lease_session = NULL;
dentry->d_fsdata = di;