ceph: fix memory leak due to possible dentry init race

Free dentry_info in error path.

Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
Sage Weil 2010-04-23 11:36:54 -07:00
Родитель 559c1e0073
Коммит 8c6efb58a5
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -51,8 +51,11 @@ int ceph_init_dentry(struct dentry *dentry)
return -ENOMEM; /* oh well */ return -ENOMEM; /* oh well */
spin_lock(&dentry->d_lock); 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; goto out_unlock;
}
di->dentry = dentry; di->dentry = dentry;
di->lease_session = NULL; di->lease_session = NULL;
dentry->d_fsdata = di; dentry->d_fsdata = di;