|
32 | 32 |
|
33 | 33 | #include <trace/events/module.h>
|
34 | 34 |
|
35 |
| -#define CAP_BSET (void *)1 |
36 |
| -#define CAP_PI (void *)2 |
37 |
| - |
38 | 35 | static kernel_cap_t usermodehelper_bset = CAP_FULL_SET;
|
39 | 36 | static kernel_cap_t usermodehelper_inheritable = CAP_FULL_SET;
|
40 | 37 | static DEFINE_SPINLOCK(umh_sysctl_lock);
|
@@ -512,16 +509,11 @@ static int proc_cap_handler(struct ctl_table *table, int write,
|
512 | 509 | /*
|
513 | 510 | * convert from the global kernel_cap_t to the ulong array to print to
|
514 | 511 | * userspace if this is a read.
|
| 512 | + * |
| 513 | + * Legacy format: capabilities are exposed as two 32-bit values |
515 | 514 | */
|
| 515 | + cap = table->data; |
516 | 516 | spin_lock(&umh_sysctl_lock);
|
517 |
| - if (table->data == CAP_BSET) |
518 |
| - cap = &usermodehelper_bset; |
519 |
| - else if (table->data == CAP_PI) |
520 |
| - cap = &usermodehelper_inheritable; |
521 |
| - else |
522 |
| - BUG(); |
523 |
| - |
524 |
| - /* Legacy format: capabilities are exposed as two 32-bit values */ |
525 | 517 | cap_array[0] = (u32) cap->val;
|
526 | 518 | cap_array[1] = cap->val >> 32;
|
527 | 519 | spin_unlock(&umh_sysctl_lock);
|
@@ -555,14 +547,14 @@ static int proc_cap_handler(struct ctl_table *table, int write,
|
555 | 547 | struct ctl_table usermodehelper_table[] = {
|
556 | 548 | {
|
557 | 549 | .procname = "bset",
|
558 |
| - .data = CAP_BSET, |
| 550 | + .data = &usermodehelper_bset, |
559 | 551 | .maxlen = 2 * sizeof(unsigned long),
|
560 | 552 | .mode = 0600,
|
561 | 553 | .proc_handler = proc_cap_handler,
|
562 | 554 | },
|
563 | 555 | {
|
564 | 556 | .procname = "inheritable",
|
565 |
| - .data = CAP_PI, |
| 557 | + .data = &usermodehelper_inheritable, |
566 | 558 | .maxlen = 2 * sizeof(unsigned long),
|
567 | 559 | .mode = 0600,
|
568 | 560 | .proc_handler = proc_cap_handler,
|
|
0 commit comments