aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.c
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2009-07-09 13:33:38 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-24 15:05:10 -0400
commitfcf89d05404dafcde581d44dfa89bd8c8def27f9 (patch)
treeaee13469f4b28bcb238d31b5760d9568b70999fc /drivers/net/wireless/iwlwifi/iwl-debugfs.c
parentf5ad69fa47e7b204d0032d569812544cd9a351fb (diff)
iwlwifi: fix permissions on debugfs files
debugfs files are created with 644 permissions which gives everybody read access. This presents a security issue if a user opens the file and holds it open at the time the driver removes the file. At this point invalid memory will be accessed. Fix this by only allowing root to read debugfs files. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index e38ec81b839b..0b9e824b67c2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -49,7 +49,8 @@
49 49
50#define DEBUGFS_ADD_FILE(name, parent) do { \ 50#define DEBUGFS_ADD_FILE(name, parent) do { \
51 dbgfs->dbgfs_##parent##_files.file_##name = \ 51 dbgfs->dbgfs_##parent##_files.file_##name = \
52 debugfs_create_file(#name, 0644, dbgfs->dir_##parent, priv, \ 52 debugfs_create_file(#name, S_IWUSR | S_IRUSR, \
53 dbgfs->dir_##parent, priv, \
53 &iwl_dbgfs_##name##_ops); \ 54 &iwl_dbgfs_##name##_ops); \
54 if (!(dbgfs->dbgfs_##parent##_files.file_##name)) \ 55 if (!(dbgfs->dbgfs_##parent##_files.file_##name)) \
55 goto err; \ 56 goto err; \
@@ -57,7 +58,8 @@
57 58
58#define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \ 59#define DEBUGFS_ADD_BOOL(name, parent, ptr) do { \
59 dbgfs->dbgfs_##parent##_files.file_##name = \ 60 dbgfs->dbgfs_##parent##_files.file_##name = \
60 debugfs_create_bool(#name, 0644, dbgfs->dir_##parent, ptr); \ 61 debugfs_create_bool(#name, S_IWUSR | S_IRUSR, \
62 dbgfs->dir_##parent, ptr); \
61 if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \ 63 if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \
62 || !dbgfs->dbgfs_##parent##_files.file_##name) \ 64 || !dbgfs->dbgfs_##parent##_files.file_##name) \
63 goto err; \ 65 goto err; \
@@ -65,7 +67,7 @@
65 67
66#define DEBUGFS_ADD_X32(name, parent, ptr) do { \ 68#define DEBUGFS_ADD_X32(name, parent, ptr) do { \
67 dbgfs->dbgfs_##parent##_files.file_##name = \ 69 dbgfs->dbgfs_##parent##_files.file_##name = \
68 debugfs_create_x32(#name, 0444, dbgfs->dir_##parent, ptr); \ 70 debugfs_create_x32(#name, S_IRUSR, dbgfs->dir_##parent, ptr); \
69 if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \ 71 if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name) \
70 || !dbgfs->dbgfs_##parent##_files.file_##name) \ 72 || !dbgfs->dbgfs_##parent##_files.file_##name) \
71 goto err; \ 73 goto err; \