diff options
Diffstat (limited to 'net/mac80211/debugfs_key.c')
-rw-r--r-- | net/mac80211/debugfs_key.c | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 99c752588b30..97c9e46e859e 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
@@ -9,6 +9,7 @@ | |||
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <linux/kobject.h> | 11 | #include <linux/kobject.h> |
12 | #include <linux/slab.h> | ||
12 | #include "ieee80211_i.h" | 13 | #include "ieee80211_i.h" |
13 | #include "key.h" | 14 | #include "key.h" |
14 | #include "debugfs.h" | 15 | #include "debugfs.h" |
@@ -56,7 +57,7 @@ KEY_CONF_FILE(keyidx, D); | |||
56 | KEY_CONF_FILE(hw_key_idx, D); | 57 | KEY_CONF_FILE(hw_key_idx, D); |
57 | KEY_FILE(flags, X); | 58 | KEY_FILE(flags, X); |
58 | KEY_FILE(tx_rx_count, D); | 59 | KEY_FILE(tx_rx_count, D); |
59 | KEY_READ(ifindex, sdata->dev->ifindex, 20, "%d\n"); | 60 | KEY_READ(ifindex, sdata->name, IFNAMSIZ + 2, "%s\n"); |
60 | KEY_OPS(ifindex); | 61 | KEY_OPS(ifindex); |
61 | 62 | ||
62 | static ssize_t key_algorithm_read(struct file *file, | 63 | static ssize_t key_algorithm_read(struct file *file, |
@@ -225,8 +226,8 @@ static ssize_t key_key_read(struct file *file, char __user *userbuf, | |||
225 | KEY_OPS(key); | 226 | KEY_OPS(key); |
226 | 227 | ||
227 | #define DEBUGFS_ADD(name) \ | 228 | #define DEBUGFS_ADD(name) \ |
228 | key->debugfs.name = debugfs_create_file(#name, 0400,\ | 229 | debugfs_create_file(#name, 0400, key->debugfs.dir, \ |
229 | key->debugfs.dir, key, &key_##name##_ops); | 230 | key, &key_##name##_ops); |
230 | 231 | ||
231 | void ieee80211_debugfs_key_add(struct ieee80211_key *key) | 232 | void ieee80211_debugfs_key_add(struct ieee80211_key *key) |
232 | { | 233 | { |
@@ -271,30 +272,12 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key) | |||
271 | DEBUGFS_ADD(ifindex); | 272 | DEBUGFS_ADD(ifindex); |
272 | }; | 273 | }; |
273 | 274 | ||
274 | #define DEBUGFS_DEL(name) \ | ||
275 | debugfs_remove(key->debugfs.name); key->debugfs.name = NULL; | ||
276 | |||
277 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key) | 275 | void ieee80211_debugfs_key_remove(struct ieee80211_key *key) |
278 | { | 276 | { |
279 | if (!key) | 277 | if (!key) |
280 | return; | 278 | return; |
281 | 279 | ||
282 | DEBUGFS_DEL(keylen); | 280 | debugfs_remove_recursive(key->debugfs.dir); |
283 | DEBUGFS_DEL(flags); | ||
284 | DEBUGFS_DEL(keyidx); | ||
285 | DEBUGFS_DEL(hw_key_idx); | ||
286 | DEBUGFS_DEL(tx_rx_count); | ||
287 | DEBUGFS_DEL(algorithm); | ||
288 | DEBUGFS_DEL(tx_spec); | ||
289 | DEBUGFS_DEL(rx_spec); | ||
290 | DEBUGFS_DEL(replays); | ||
291 | DEBUGFS_DEL(icverrors); | ||
292 | DEBUGFS_DEL(key); | ||
293 | DEBUGFS_DEL(ifindex); | ||
294 | |||
295 | debugfs_remove(key->debugfs.stalink); | ||
296 | key->debugfs.stalink = NULL; | ||
297 | debugfs_remove(key->debugfs.dir); | ||
298 | key->debugfs.dir = NULL; | 281 | key->debugfs.dir = NULL; |
299 | } | 282 | } |
300 | void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | 283 | void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) |
@@ -302,7 +285,7 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | |||
302 | char buf[50]; | 285 | char buf[50]; |
303 | struct ieee80211_key *key; | 286 | struct ieee80211_key *key; |
304 | 287 | ||
305 | if (!sdata->debugfsdir) | 288 | if (!sdata->debugfs.dir) |
306 | return; | 289 | return; |
307 | 290 | ||
308 | /* this is running under the key lock */ | 291 | /* this is running under the key lock */ |
@@ -310,9 +293,9 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | |||
310 | key = sdata->default_key; | 293 | key = sdata->default_key; |
311 | if (key) { | 294 | if (key) { |
312 | sprintf(buf, "../keys/%d", key->debugfs.cnt); | 295 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
313 | sdata->common_debugfs.default_key = | 296 | sdata->debugfs.default_key = |
314 | debugfs_create_symlink("default_key", | 297 | debugfs_create_symlink("default_key", |
315 | sdata->debugfsdir, buf); | 298 | sdata->debugfs.dir, buf); |
316 | } else | 299 | } else |
317 | ieee80211_debugfs_key_remove_default(sdata); | 300 | ieee80211_debugfs_key_remove_default(sdata); |
318 | } | 301 | } |
@@ -322,8 +305,8 @@ void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata) | |||
322 | if (!sdata) | 305 | if (!sdata) |
323 | return; | 306 | return; |
324 | 307 | ||
325 | debugfs_remove(sdata->common_debugfs.default_key); | 308 | debugfs_remove(sdata->debugfs.default_key); |
326 | sdata->common_debugfs.default_key = NULL; | 309 | sdata->debugfs.default_key = NULL; |
327 | } | 310 | } |
328 | 311 | ||
329 | void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) | 312 | void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) |
@@ -331,7 +314,7 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) | |||
331 | char buf[50]; | 314 | char buf[50]; |
332 | struct ieee80211_key *key; | 315 | struct ieee80211_key *key; |
333 | 316 | ||
334 | if (!sdata->debugfsdir) | 317 | if (!sdata->debugfs.dir) |
335 | return; | 318 | return; |
336 | 319 | ||
337 | /* this is running under the key lock */ | 320 | /* this is running under the key lock */ |
@@ -339,9 +322,9 @@ void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata) | |||
339 | key = sdata->default_mgmt_key; | 322 | key = sdata->default_mgmt_key; |
340 | if (key) { | 323 | if (key) { |
341 | sprintf(buf, "../keys/%d", key->debugfs.cnt); | 324 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
342 | sdata->common_debugfs.default_mgmt_key = | 325 | sdata->debugfs.default_mgmt_key = |
343 | debugfs_create_symlink("default_mgmt_key", | 326 | debugfs_create_symlink("default_mgmt_key", |
344 | sdata->debugfsdir, buf); | 327 | sdata->debugfs.dir, buf); |
345 | } else | 328 | } else |
346 | ieee80211_debugfs_key_remove_mgmt_default(sdata); | 329 | ieee80211_debugfs_key_remove_mgmt_default(sdata); |
347 | } | 330 | } |
@@ -351,8 +334,8 @@ void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sda | |||
351 | if (!sdata) | 334 | if (!sdata) |
352 | return; | 335 | return; |
353 | 336 | ||
354 | debugfs_remove(sdata->common_debugfs.default_mgmt_key); | 337 | debugfs_remove(sdata->debugfs.default_mgmt_key); |
355 | sdata->common_debugfs.default_mgmt_key = NULL; | 338 | sdata->debugfs.default_mgmt_key = NULL; |
356 | } | 339 | } |
357 | 340 | ||
358 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, | 341 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |