]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
mac80211: make debugfs files root-only
authorJohannes Berg <johannes@sipsolutions.net>
Fri, 4 Apr 2008 21:33:37 +0000 (23:33 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Apr 2008 20:44:43 +0000 (16:44 -0400)
Unfortunately, debugfs can be made to access invalid memory by
open()ing a file and then waiting until the corresponding debugfs
file has been removed (and, probably, the underlying object.)

That could be exploited by any user if the user is able to open
debugfs files and can cause networking devices, STA entries or
similar to disappear which is quite easy to do.

Hence, all debugfs files should be root-only.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/debugfs.c
net/mac80211/debugfs_netdev.c
net/mac80211/debugfs_sta.c

index 4736c64937b4d0eafa03cb463fb14248e34139de..f4bb08b62d1a009ed8bb6dd113203694bff1e078 100644 (file)
@@ -37,7 +37,7 @@ static const struct file_operations name## _ops = {                   \
 };
 
 #define DEBUGFS_ADD(name)                                              \
-       local->debugfs.name = debugfs_create_file(#name, 0444, phyd,    \
+       local->debugfs.name = debugfs_create_file(#name, 0400, phyd,    \
                                                  local, &name## _ops);
 
 #define DEBUGFS_DEL(name)                                              \
@@ -130,7 +130,7 @@ static const struct file_operations stats_ ##name## _ops = {                \
 };
 
 #define DEBUGFS_STATS_ADD(name)                                                \
-       local->debugfs.stats.name = debugfs_create_file(#name, 0444, statsd,\
+       local->debugfs.stats.name = debugfs_create_file(#name, 0400, statsd,\
                local, &stats_ ##name## _ops);
 
 #define DEBUGFS_STATS_DEL(name)                                                \
index 3e19d42e61cb2ca9416edbdf5cd42035a7282370..55cd6fc3f2e0ccb007168f0e37ec27696da0e022 100644 (file)
@@ -243,7 +243,7 @@ IEEE80211_IF_WFILE(min_discovery_timeout,
 
 
 #define DEBUGFS_ADD(name, type)\
-       sdata->debugfs.type.name = debugfs_create_file(#name, 0444,\
+       sdata->debugfs.type.name = debugfs_create_file(#name, 0400,\
                sdata->debugfsdir, sdata, &name##_ops);
 
 static void add_sta_files(struct ieee80211_sub_if_data *sdata)
@@ -298,7 +298,7 @@ static void add_monitor_files(struct ieee80211_sub_if_data *sdata)
 
 #ifdef CONFIG_MAC80211_MESH
 #define MESHSTATS_ADD(name)\
-       sdata->mesh_stats.name = debugfs_create_file(#name, 0444,\
+       sdata->mesh_stats.name = debugfs_create_file(#name, 0400,\
                sdata->mesh_stats_dir, sdata, &name##_ops);
 
 static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
@@ -312,7 +312,7 @@ static void add_mesh_stats(struct ieee80211_sub_if_data *sdata)
 }
 
 #define MESHPARAMS_ADD(name)\
-       sdata->mesh_config.name = debugfs_create_file(#name, 0644,\
+       sdata->mesh_config.name = debugfs_create_file(#name, 0600,\
                sdata->mesh_config_dir, sdata, &name##_ops);
 
 static void add_mesh_config(struct ieee80211_sub_if_data *sdata)
index 256ea880d28bbf4dea8982d87da723fb1961efb2..6d47a1d31b37a550164e424ca9571b67709418db 100644 (file)
@@ -266,7 +266,7 @@ static ssize_t sta_agg_status_write(struct file *file,
 STA_OPS_WR(agg_status);
 
 #define DEBUGFS_ADD(name) \
-       sta->debugfs.name = debugfs_create_file(#name, 0444, \
+       sta->debugfs.name = debugfs_create_file(#name, 0400, \
                sta->debugfs.dir, sta, &sta_ ##name## _ops);
 
 #define DEBUGFS_DEL(name) \