Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111304
b: refs/heads/master
c: 849e057
h: refs/heads/master
v: v3
  • Loading branch information
Henrique de Moraes Holschuh authored and John W. Linville committed Aug 29, 2008
1 parent 68f5b51 commit 2c396fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5701ed843ea87bf8a1d2c4dee5edcb463558db4a
refs/heads/master: 849e0576a76bc421aacd782f97948856f487726c
14 changes: 12 additions & 2 deletions trunk/net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,16 @@ static ssize_t rfkill_state_store(struct device *dev,
const char *buf, size_t count)
{
struct rfkill *rfkill = to_rfkill(dev);
unsigned int state = simple_strtoul(buf, NULL, 0);
unsigned long state;
int error;

if (!capable(CAP_NET_ADMIN))
return -EPERM;

error = strict_strtoul(buf, 0, &state);
if (error)
return error;

/* RFKILL_STATE_HARD_BLOCKED is illegal here... */
if (state != RFKILL_STATE_UNBLOCKED &&
state != RFKILL_STATE_SOFT_BLOCKED)
Expand Down Expand Up @@ -435,7 +439,8 @@ static ssize_t rfkill_claim_store(struct device *dev,
const char *buf, size_t count)
{
struct rfkill *rfkill = to_rfkill(dev);
bool claim = !!simple_strtoul(buf, NULL, 0);
unsigned long claim_tmp;
bool claim;
int error;

if (!capable(CAP_NET_ADMIN))
Expand All @@ -444,6 +449,11 @@ static ssize_t rfkill_claim_store(struct device *dev,
if (rfkill->user_claim_unsupported)
return -EOPNOTSUPP;

error = strict_strtoul(buf, 0, &claim_tmp);
if (error)
return error;
claim = !!claim_tmp;

/*
* Take the global lock to make sure the kernel is not in
* the middle of rfkill_switch_all
Expand Down

0 comments on commit 2c396fb

Please sign in to comment.