Skip to contentSkip to conversation

Patch "tracefs: Fix refcount imbalance in start_creating()" has been added to the 4.3-stable tree

PATCH [email protected] 1 participant 1 message Feb 13, 2016

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

tracefs: Fix refcount imbalance in start_creating()

to the 4.3-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
tracefs-fix-refcount-imbalance-in-start_creating.patch
and it can be found in the queue-4.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From d227c3ae4e94e5eb11dd780a811f59e1a7b74ccd Mon Sep 17 00:00:00 2001

From: Daniel Borkmann <[email protected]>
Date: Wed, 4 Nov 2015 23:33:17 +0100
Subject: tracefs: Fix refcount imbalance in start_creating()

From: Daniel Borkmann <[email protected]>

commit d227c3ae4e94e5eb11dd780a811f59e1a7b74ccd upstream.

In tracefs' start_creating(), we pin the file system to safely access its root. When we failed to create a file, we unpin the file system via failed_creating() to release the mount count and eventually the reference of the singleton vfsmount.

However, when we run into an error during lookup_one_len() when still in start_creating(), we only release the parent's mutex but not so the reference on the mount.

F.e., in securityfs_create_file(), after doing simple_pin_fs() when lookup_one_len() fails there, we infact do simple_release_fs(). This seems necessary here as well.

Same issue seen in debugfs due to 190afd81e4a5 ("debugfs: split the beginning and the end of __create_file() off"), which seemed to got carried over into tracefs, too. Noticed during code review.

Fixes 4282d60689d4 ("tracefs: Add new tracefs file system")
---
 fs/tracefs/inode.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/tracefs/inode.c +5 -1
@@ -340,8 +340,12 @@ static struct dentry *start_creating(con
 		dput(dentry);
 		dentry = ERR_PTR(-EEXIST);
 	}
-	if (IS_ERR(dentry))
+
+	if (IS_ERR(dentry)) {
 		mutex_unlock(&parent->d_inode->i_mutex);
+		simple_release_fs(&tracefs_mount, &tracefs_mount_count);
+	}
+
 	return dentry;
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.3/tracefs-fix-refcount-imbalance-in-start_creating.patch