Skip to contentSkip to conversation

debugfs: fixup to file removal protection series

PATCH In review Nicolai Stange 1 participant 4 messages Mar 6, 2016 – Mar 22, 2016 Driver core

lore
Share & tools
lore
#0 lore raw

cover debugfs: fixup to file removal protection series

Version v4 of the series ("fix debugfs file removal races") to be found at http://lkml.kernel.org/g/[email protected]
has been applied to the driver-core tree's driver-core-testing branch.

Unfortunately, the kbuild test robot discovered two minor issues.

To fix these, there are two options. The first one is to replace the v4 version of the aforementioned series with v5 available at
http://lkml.kernel.org/g/[email protected]

The other, rebaseless option is to apply the two fixup patches contained within this series.

Both ways lead to identical code in the end.

This series is applicable to the the driver-core tree's driver-core-testing branch.

Nicolai Stange (2):
debugfs: fix DocBook comment of debugfs_use_file_start()
debugfs: inline dummy implementations of

    debugfs_use_file_start()/_finish()
 fs/debugfs/file.c       | 2 +-
 include/linux/debugfs.h | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.2
#1 lore raw

PATCH 1/2 debugfs: fix DocBook comment of debugfs_use_file_start()

In commit 055cd38ba671 ("debugfs: prevent access to possibly dead
file_operations at file open")
debugfs_use_file_start() has been introduced. Unfortunately, the associated DocBook comment hasn't been updated to properly reflect the change of the 'file' argument into 'dentry' during the evolution of the aforementioned patch.

Catch up on this and rename '@file' to '@dentry' in the DocBook comment associated with debugfs_use_file_start().

---
 fs/debugfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/debugfs/file.c +1 -1
index 1a03e99..6a4b667 100644
@@ -50,7 +50,7 @@ const struct file_operations debugfs_noop_file_operations = {
 
 /**
  * debugfs_use_file_start - mark the beginning of file data access
- * @file: the file object whose data is being accessed.
+ * @dentry: the dentry object whose data is being accessed.
  * @srcu_idx: a pointer to some memory to store a SRCU index in.
  *
  * Up to a matching call to debugfs_use_file_finish(), any
Signature · 1 line
2.7.2
#2 lore raw

PATCH 2/2 debugfs: inline dummy implementations of debugfs_use_file_start()/_finish()

In reply to Nicolai Stange

In commit 921d5cbeb37c ("debugfs: prevent access to removed files'
private data")
the functions debugfs_use_file_start() and debugfs_use_file_finish() have been exported from the debugfs core.

Unfortunately, the inline keyword has been missed at their noop implementations provided for the CONFIG_DEBUG_FS=n case.

Due to this lapse, the kbuild test robot moans on a powerpc defconfig build:

In file included from arch/powerpc/kernel/irq.c:54:0:
include/linux/debugfs.h:185:12: error: 'debugfs_use_file_start'
defined but not used [-Werror=unused-function] static int debugfs_use_file_start(const struct dentry *dentry,
int *srcu_idx)

include/linux/debugfs.h:191:13: error: 'debugfs_use_file_finish'
defined but not used [-Werror=unused-function] static void debugfs_use_file_finish(int srcu_idx)

Add the inline keyword to the CONFIG_DEBUG_FS=n noop implementations of debugfs_use_file_start() and debugfs_use_file_finish().

---
 include/linux/debugfs.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/debugfs.h +4 -2
index e7d2a99..1438e23 100644
@@ -205,13 +205,15 @@ static inline void debugfs_remove(struct dentry *dentry)
 static inline void debugfs_remove_recursive(struct dentry *dentry)
 { }
 
-static int debugfs_use_file_start(const struct dentry *dentry, int *srcu_idx)
+static inline int debugfs_use_file_start(const struct dentry *dentry,
+					int *srcu_idx)
 	__acquires(&debugfs_srcu)
 {
 	return 0;
 }
 
-static void debugfs_use_file_finish(int srcu_idx) __releases(&debugfs_srcu)
+static inline void debugfs_use_file_finish(int srcu_idx)
+	__releases(&debugfs_srcu)
 { }
 
 #define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt)	\
Signature · 1 line
2.7.2