diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-07-27 09:06:05 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-01 15:31:34 -0400 |
commit | d2b690714cd7d328561bfb9bf941edd6a3316a85 (patch) | |
tree | ee86931bb3a52998ba29266d038d8e219aba3824 /drivers/net/wireless/rt2x00 | |
parent | 7c7e6af37dad30632103497a72a1273d18ec55fe (diff) |
rt2x00: Fix access permissions on debugfs files
Although most rt2x00 debugfs files don't contain
information which could compromise network security,
it is better to set the access permissions to root only.
This will be required when HW crypto is implemented,
because it could be possible to read the HW key from
the registers.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00debug.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c index 300cf061035f..6bee1d611bbf 100644 --- a/drivers/net/wireless/rt2x00/rt2x00debug.c +++ b/drivers/net/wireless/rt2x00/rt2x00debug.c | |||
@@ -372,9 +372,6 @@ static ssize_t rt2x00debug_write_##__name(struct file *file, \ | |||
372 | if (*offset) \ | 372 | if (*offset) \ |
373 | return 0; \ | 373 | return 0; \ |
374 | \ | 374 | \ |
375 | if (!capable(CAP_NET_ADMIN)) \ | ||
376 | return -EPERM; \ | ||
377 | \ | ||
378 | if (intf->offset_##__name >= debug->__name.word_count) \ | 375 | if (intf->offset_##__name >= debug->__name.word_count) \ |
379 | return -EINVAL; \ | 376 | return -EINVAL; \ |
380 | \ | 377 | \ |
@@ -454,7 +451,7 @@ static struct dentry *rt2x00debug_create_file_driver(const char *name, | |||
454 | data += sprintf(data, "compiled: %s %s\n", __DATE__, __TIME__); | 451 | data += sprintf(data, "compiled: %s %s\n", __DATE__, __TIME__); |
455 | blob->size = strlen(blob->data); | 452 | blob->size = strlen(blob->data); |
456 | 453 | ||
457 | return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob); | 454 | return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); |
458 | } | 455 | } |
459 | 456 | ||
460 | static struct dentry *rt2x00debug_create_file_chipset(const char *name, | 457 | static struct dentry *rt2x00debug_create_file_chipset(const char *name, |
@@ -482,7 +479,7 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name, | |||
482 | data += sprintf(data, "rf length: %d\n", debug->rf.word_count); | 479 | data += sprintf(data, "rf length: %d\n", debug->rf.word_count); |
483 | blob->size = strlen(blob->data); | 480 | blob->size = strlen(blob->data); |
484 | 481 | ||
485 | return debugfs_create_blob(name, S_IRUGO, intf->driver_folder, blob); | 482 | return debugfs_create_blob(name, S_IRUSR, intf->driver_folder, blob); |
486 | } | 483 | } |
487 | 484 | ||
488 | void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | 485 | void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) |
@@ -517,7 +514,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
517 | if (IS_ERR(intf->chipset_entry)) | 514 | if (IS_ERR(intf->chipset_entry)) |
518 | goto exit; | 515 | goto exit; |
519 | 516 | ||
520 | intf->dev_flags = debugfs_create_file("dev_flags", S_IRUGO, | 517 | intf->dev_flags = debugfs_create_file("dev_flags", S_IRUSR, |
521 | intf->driver_folder, intf, | 518 | intf->driver_folder, intf, |
522 | &rt2x00debug_fop_dev_flags); | 519 | &rt2x00debug_fop_dev_flags); |
523 | if (IS_ERR(intf->dev_flags)) | 520 | if (IS_ERR(intf->dev_flags)) |
@@ -532,7 +529,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
532 | ({ \ | 529 | ({ \ |
533 | (__intf)->__name##_off_entry = \ | 530 | (__intf)->__name##_off_entry = \ |
534 | debugfs_create_u32(__stringify(__name) "_offset", \ | 531 | debugfs_create_u32(__stringify(__name) "_offset", \ |
535 | S_IRUGO | S_IWUSR, \ | 532 | S_IRUSR | S_IWUSR, \ |
536 | (__intf)->register_folder, \ | 533 | (__intf)->register_folder, \ |
537 | &(__intf)->offset_##__name); \ | 534 | &(__intf)->offset_##__name); \ |
538 | if (IS_ERR((__intf)->__name##_off_entry)) \ | 535 | if (IS_ERR((__intf)->__name##_off_entry)) \ |
@@ -540,7 +537,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
540 | \ | 537 | \ |
541 | (__intf)->__name##_val_entry = \ | 538 | (__intf)->__name##_val_entry = \ |
542 | debugfs_create_file(__stringify(__name) "_value", \ | 539 | debugfs_create_file(__stringify(__name) "_value", \ |
543 | S_IRUGO | S_IWUSR, \ | 540 | S_IRUSR | S_IWUSR, \ |
544 | (__intf)->register_folder, \ | 541 | (__intf)->register_folder, \ |
545 | (__intf), &rt2x00debug_fop_##__name);\ | 542 | (__intf), &rt2x00debug_fop_##__name);\ |
546 | if (IS_ERR((__intf)->__name##_val_entry)) \ | 543 | if (IS_ERR((__intf)->__name##_val_entry)) \ |
@@ -560,7 +557,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
560 | goto exit; | 557 | goto exit; |
561 | 558 | ||
562 | intf->queue_frame_dump_entry = | 559 | intf->queue_frame_dump_entry = |
563 | debugfs_create_file("dump", S_IRUGO, intf->queue_folder, | 560 | debugfs_create_file("dump", S_IRUSR, intf->queue_folder, |
564 | intf, &rt2x00debug_fop_queue_dump); | 561 | intf, &rt2x00debug_fop_queue_dump); |
565 | if (IS_ERR(intf->queue_frame_dump_entry)) | 562 | if (IS_ERR(intf->queue_frame_dump_entry)) |
566 | goto exit; | 563 | goto exit; |
@@ -569,7 +566,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) | |||
569 | init_waitqueue_head(&intf->frame_dump_waitqueue); | 566 | init_waitqueue_head(&intf->frame_dump_waitqueue); |
570 | 567 | ||
571 | intf->queue_stats_entry = | 568 | intf->queue_stats_entry = |
572 | debugfs_create_file("queue", S_IRUGO, intf->queue_folder, | 569 | debugfs_create_file("queue", S_IRUSR, intf->queue_folder, |
573 | intf, &rt2x00debug_fop_queue_stats); | 570 | intf, &rt2x00debug_fop_queue_stats); |
574 | 571 | ||
575 | return; | 572 | return; |