diff options
Diffstat (limited to 'net/mac80211/debugfs_netdev.c')
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index 9affe2cd185f..83d4289d954b 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/interrupt.h> | 13 | #include <linux/interrupt.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/rtnetlink.h> | 15 | #include <linux/rtnetlink.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/notifier.h> | 17 | #include <linux/notifier.h> |
17 | #include <net/mac80211.h> | 18 | #include <net/mac80211.h> |
18 | #include <net/cfg80211.h> | 19 | #include <net/cfg80211.h> |
@@ -48,20 +49,24 @@ static ssize_t ieee80211_if_write( | |||
48 | ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int)) | 49 | ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int)) |
49 | { | 50 | { |
50 | u8 *buf; | 51 | u8 *buf; |
51 | ssize_t ret = -ENODEV; | 52 | ssize_t ret; |
52 | 53 | ||
53 | buf = kzalloc(count, GFP_KERNEL); | 54 | buf = kmalloc(count, GFP_KERNEL); |
54 | if (!buf) | 55 | if (!buf) |
55 | return -ENOMEM; | 56 | return -ENOMEM; |
56 | 57 | ||
58 | ret = -EFAULT; | ||
57 | if (copy_from_user(buf, userbuf, count)) | 59 | if (copy_from_user(buf, userbuf, count)) |
58 | return -EFAULT; | 60 | goto freebuf; |
59 | 61 | ||
62 | ret = -ENODEV; | ||
60 | rtnl_lock(); | 63 | rtnl_lock(); |
61 | if (sdata->dev->reg_state == NETREG_REGISTERED) | 64 | if (sdata->dev->reg_state == NETREG_REGISTERED) |
62 | ret = (*write)(sdata, buf, count); | 65 | ret = (*write)(sdata, buf, count); |
63 | rtnl_unlock(); | 66 | rtnl_unlock(); |
64 | 67 | ||
68 | freebuf: | ||
69 | kfree(buf); | ||
65 | return ret; | 70 | return ret; |
66 | } | 71 | } |
67 | 72 | ||