diff options
author | Sage Weil <sage@newdream.net> | 2010-04-23 14:36:54 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-05-17 18:25:23 -0400 |
commit | 8c6efb58a5bab880d45b2078cb55ec4320707daf (patch) | |
tree | fe4d72552be0525905d569f0efd09938c6175369 /fs/ceph/dir.c | |
parent | 559c1e0073ae779d60e1c673cda837f3e4295302 (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.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 33feac75c532..422794fd10e0 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -51,8 +51,11 @@ int ceph_init_dentry(struct dentry *dentry) | |||
51 | return -ENOMEM; /* oh well */ | 51 | return -ENOMEM; /* oh well */ |
52 | 52 | ||
53 | spin_lock(&dentry->d_lock); | 53 | spin_lock(&dentry->d_lock); |
54 | if (dentry->d_fsdata) /* lost a race */ | 54 | if (dentry->d_fsdata) { |
55 | /* lost a race */ | ||
56 | kmem_cache_free(ceph_dentry_cachep, di); | ||
55 | goto out_unlock; | 57 | goto out_unlock; |
58 | } | ||
56 | di->dentry = dentry; | 59 | di->dentry = dentry; |
57 | di->lease_session = NULL; | 60 | di->lease_session = NULL; |
58 | dentry->d_fsdata = di; | 61 | dentry->d_fsdata = di; |