Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8c6efb58 authored by Sage Weil's avatar Sage Weil
Browse files

ceph: fix memory leak due to possible dentry init race



Free dentry_info in error path.

Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 559c1e00
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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;