[PATCH 07/14] header: debugfs.h: add DEFINE_DEBUGFS_ATTRIBUTE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



DEFINE_DEBUGFS_ATTRIBUTE and debugfs_create_file_unsafe() were
introduced in mainline commit c6468808149 ("debugfs: add support for
self-protecting attribute file fops"), but on older kernel versions
where we do not have this extra security in debugfs we can use the older
functions instead.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/debugfs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/backport/backport-include/linux/debugfs.h b/backport/backport-include/linux/debugfs.h
index 11670388..fb50c4f5 100644
--- a/backport/backport-include/linux/debugfs.h
+++ b/backport/backport-include/linux/debugfs.h
@@ -53,4 +53,11 @@ debugfs_real_fops(const struct file *filp)
 }
 #endif /* <4.9.0 but not >= 4.8.4, 4.7.10 */
 
+#ifndef DEFINE_DEBUGFS_ATTRIBUTE
+#define DEFINE_DEBUGFS_ATTRIBUTE(__fops, __get, __set, __fmt) \
+	DEFINE_SIMPLE_ATTRIBUTE(__fops, __get, __set, __fmt)
+#define debugfs_create_file_unsafe(name, mode, parent, data, fops) \
+	debugfs_create_file(name, mode, parent, data, fops)
+#endif
+
 #endif /* __BACKPORT_DEBUGFS_H_ */
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux