Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 155856
b: refs/heads/master
c: f54c142
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jul 21, 2009
1 parent 785aed1 commit ed9c17c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 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: e2e414d92397c366396d13f627a98a20be92e509
refs/heads/master: f54c142725ad2ba33c3ee627873cb6966bf05447
27 changes: 19 additions & 8 deletions trunk/net/rfkill/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -648,15 +648,26 @@ static ssize_t rfkill_state_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
/*
* The intention was that userspace can only take control over
* a given device when/if rfkill-input doesn't control it due
* to user_claim. Since user_claim is currently unsupported,
* we never support changing the state from userspace -- this
* can be implemented again later.
*/
struct rfkill *rfkill = to_rfkill(dev);
unsigned long state;
int err;

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

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

if (state != RFKILL_USER_STATE_SOFT_BLOCKED &&
state != RFKILL_USER_STATE_UNBLOCKED)
return -EINVAL;

mutex_lock(&rfkill_global_mutex);
rfkill_set_block(rfkill, state == RFKILL_USER_STATE_SOFT_BLOCKED);
mutex_unlock(&rfkill_global_mutex);

return -EPERM;
return err ?: count;
}

static ssize_t rfkill_claim_show(struct device *dev,
Expand Down

0 comments on commit ed9c17c

Please sign in to comment.