diff options
Diffstat (limited to 'net/mac80211/debugfs_netdev.c')
-rw-r--r-- | net/mac80211/debugfs_netdev.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c index f6de8a65f402..ef5cf2685657 100644 --- a/net/mac80211/debugfs_netdev.c +++ b/net/mac80211/debugfs_netdev.c | |||
@@ -49,16 +49,15 @@ static ssize_t ieee80211_if_write( | |||
49 | size_t count, loff_t *ppos, | 49 | size_t count, loff_t *ppos, |
50 | ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int)) | 50 | ssize_t (*write)(struct ieee80211_sub_if_data *, const char *, int)) |
51 | { | 51 | { |
52 | u8 *buf; | 52 | char buf[64]; |
53 | ssize_t ret; | 53 | ssize_t ret; |
54 | 54 | ||
55 | buf = kmalloc(count, GFP_KERNEL); | 55 | if (count >= sizeof(buf)) |
56 | if (!buf) | 56 | return -E2BIG; |
57 | return -ENOMEM; | ||
58 | 57 | ||
59 | ret = -EFAULT; | ||
60 | if (copy_from_user(buf, userbuf, count)) | 58 | if (copy_from_user(buf, userbuf, count)) |
61 | goto freebuf; | 59 | return -EFAULT; |
60 | buf[count] = '\0'; | ||
62 | 61 | ||
63 | ret = -ENODEV; | 62 | ret = -ENODEV; |
64 | rtnl_lock(); | 63 | rtnl_lock(); |
@@ -66,8 +65,6 @@ static ssize_t ieee80211_if_write( | |||
66 | ret = (*write)(sdata, buf, count); | 65 | ret = (*write)(sdata, buf, count); |
67 | rtnl_unlock(); | 66 | rtnl_unlock(); |
68 | 67 | ||
69 | freebuf: | ||
70 | kfree(buf); | ||
71 | return ret; | 68 | return ret; |
72 | } | 69 | } |
73 | 70 | ||