summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/libertas/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r--drivers/net/wireless/libertas/debugfs.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 893a55ca344a..8a7e9319c9e5 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -117,6 +117,11 @@ static ssize_t lbs_sleepparams_write(struct file *file,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ ret = -EBUSY;
+ goto out_unlock;
+ }
+
buf_size = min(count, len - 1);
if (copy_from_user(buf, user_buf, buf_size)) {
ret = -EFAULT;
@@ -157,6 +162,11 @@ static ssize_t lbs_sleepparams_read(struct file *file, char __user *userbuf,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ ret = -EBUSY;
+ goto out_unlock;
+ }
+
ret = lbs_cmd_802_11_sleep_params(priv, CMD_ACT_GET, &sp);
if (ret)
goto out_unlock;
@@ -223,6 +233,9 @@ static ssize_t lbs_threshold_read(uint16_t tlv_type, uint16_t event_mask,
u8 freq;
int events = 0;
+ if (!lbs_is_cmd_allowed(priv))
+ return -EBUSY;
+
buf = (char *)get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
@@ -275,6 +288,9 @@ static ssize_t lbs_threshold_write(uint16_t tlv_type, uint16_t event_mask,
char *buf;
int ret;
+ if (!lbs_is_cmd_allowed(priv))
+ return -EBUSY;
+
buf = (char *)get_zeroed_page(GFP_KERNEL);
if (!buf)
return -ENOMEM;
@@ -444,6 +460,11 @@ static ssize_t lbs_rdmac_read(struct file *file, char __user *userbuf,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ free_page(addr);
+ return -EBUSY;
+ }
+
offval.offset = priv->mac_offset;
offval.value = 0;
@@ -496,6 +517,11 @@ static ssize_t lbs_wrmac_write(struct file *file,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ res = -EBUSY;
+ goto out_unlock;
+ }
+
buf_size = min(count, len - 1);
if (copy_from_user(buf, userbuf, buf_size)) {
res = -EFAULT;
@@ -532,6 +558,11 @@ static ssize_t lbs_rdbbp_read(struct file *file, char __user *userbuf,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ free_page(addr);
+ return -EBUSY;
+ }
+
offval.offset = priv->bbp_offset;
offval.value = 0;
@@ -585,6 +616,11 @@ static ssize_t lbs_wrbbp_write(struct file *file,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ res = -EBUSY;
+ goto out_unlock;
+ }
+
buf_size = min(count, len - 1);
if (copy_from_user(buf, userbuf, buf_size)) {
res = -EFAULT;
@@ -621,6 +657,11 @@ static ssize_t lbs_rdrf_read(struct file *file, char __user *userbuf,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ free_page(addr);
+ return -EBUSY;
+ }
+
offval.offset = priv->rf_offset;
offval.value = 0;
@@ -674,6 +715,11 @@ static ssize_t lbs_wrrf_write(struct file *file,
if (!buf)
return -ENOMEM;
+ if (!lbs_is_cmd_allowed(priv)) {
+ res = -EBUSY;
+ goto out_unlock;
+ }
+
buf_size = min(count, len - 1);
if (copy_from_user(buf, userbuf, buf_size)) {
res = -EFAULT;