diff options
Diffstat (limited to 'net/rfkill/rfkill.c')
-rw-r--r-- | net/rfkill/rfkill.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index 47e0b2d232e3..173d039d9909 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -402,12 +402,16 @@ static ssize_t rfkill_state_store(struct device *dev, | |||
402 | const char *buf, size_t count) | 402 | const char *buf, size_t count) |
403 | { | 403 | { |
404 | struct rfkill *rfkill = to_rfkill(dev); | 404 | struct rfkill *rfkill = to_rfkill(dev); |
405 | unsigned int state = simple_strtoul(buf, NULL, 0); | 405 | unsigned long state; |
406 | int error; | 406 | int error; |
407 | 407 | ||
408 | if (!capable(CAP_NET_ADMIN)) | 408 | if (!capable(CAP_NET_ADMIN)) |
409 | return -EPERM; | 409 | return -EPERM; |
410 | 410 | ||
411 | error = strict_strtoul(buf, 0, &state); | ||
412 | if (error) | ||
413 | return error; | ||
414 | |||
411 | /* RFKILL_STATE_HARD_BLOCKED is illegal here... */ | 415 | /* RFKILL_STATE_HARD_BLOCKED is illegal here... */ |
412 | if (state != RFKILL_STATE_UNBLOCKED && | 416 | if (state != RFKILL_STATE_UNBLOCKED && |
413 | state != RFKILL_STATE_SOFT_BLOCKED) | 417 | state != RFKILL_STATE_SOFT_BLOCKED) |
@@ -435,7 +439,8 @@ static ssize_t rfkill_claim_store(struct device *dev, | |||
435 | const char *buf, size_t count) | 439 | const char *buf, size_t count) |
436 | { | 440 | { |
437 | struct rfkill *rfkill = to_rfkill(dev); | 441 | struct rfkill *rfkill = to_rfkill(dev); |
438 | bool claim = !!simple_strtoul(buf, NULL, 0); | 442 | unsigned long claim_tmp; |
443 | bool claim; | ||
439 | int error; | 444 | int error; |
440 | 445 | ||
441 | if (!capable(CAP_NET_ADMIN)) | 446 | if (!capable(CAP_NET_ADMIN)) |
@@ -444,6 +449,11 @@ static ssize_t rfkill_claim_store(struct device *dev, | |||
444 | if (rfkill->user_claim_unsupported) | 449 | if (rfkill->user_claim_unsupported) |
445 | return -EOPNOTSUPP; | 450 | return -EOPNOTSUPP; |
446 | 451 | ||
452 | error = strict_strtoul(buf, 0, &claim_tmp); | ||
453 | if (error) | ||
454 | return error; | ||
455 | claim = !!claim_tmp; | ||
456 | |||
447 | /* | 457 | /* |
448 | * Take the global lock to make sure the kernel is not in | 458 | * Take the global lock to make sure the kernel is not in |
449 | * the middle of rfkill_switch_all | 459 | * the middle of rfkill_switch_all |