diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-01 15:26:47 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:49 -0400 |
commit | e6d6e3420d511cd7552a95d1f04bd4c80a9ddb34 (patch) | |
tree | 35f34c9ef8fe4c201da36ca819045995a93eeb44 /net/wireless | |
parent | dad823302135a2d99efd40e35d94a6ff14961c93 (diff) |
cfg80211: use proper allocation flags
Instead of hardcoding GFP_ATOMIC everywhere, add a
new function parameter that gets the flags from the
caller. Obviously then I need to update all callers
(all of them in mac80211), and it turns out that now
it's ok to use GFP_KERNEL in almost all places.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/mlme.c | 30 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 48 | ||||
-rw-r--r-- | net/wireless/nl80211.h | 14 |
3 files changed, 49 insertions, 43 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index e56bbea10fc8..c4e6d4b84a46 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c | |||
@@ -12,35 +12,35 @@ | |||
12 | #include "core.h" | 12 | #include "core.h" |
13 | #include "nl80211.h" | 13 | #include "nl80211.h" |
14 | 14 | ||
15 | void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len) | 15 | void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) |
16 | { | 16 | { |
17 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 17 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
18 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 18 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
19 | nl80211_send_rx_auth(rdev, dev, buf, len); | 19 | nl80211_send_rx_auth(rdev, dev, buf, len, gfp); |
20 | } | 20 | } |
21 | EXPORT_SYMBOL(cfg80211_send_rx_auth); | 21 | EXPORT_SYMBOL(cfg80211_send_rx_auth); |
22 | 22 | ||
23 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len) | 23 | void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) |
24 | { | 24 | { |
25 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 25 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
26 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 26 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
27 | nl80211_send_rx_assoc(rdev, dev, buf, len); | 27 | nl80211_send_rx_assoc(rdev, dev, buf, len, gfp); |
28 | } | 28 | } |
29 | EXPORT_SYMBOL(cfg80211_send_rx_assoc); | 29 | EXPORT_SYMBOL(cfg80211_send_rx_assoc); |
30 | 30 | ||
31 | void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len) | 31 | void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) |
32 | { | 32 | { |
33 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 33 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
34 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 34 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
35 | nl80211_send_deauth(rdev, dev, buf, len); | 35 | nl80211_send_deauth(rdev, dev, buf, len, gfp); |
36 | } | 36 | } |
37 | EXPORT_SYMBOL(cfg80211_send_deauth); | 37 | EXPORT_SYMBOL(cfg80211_send_deauth); |
38 | 38 | ||
39 | void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len) | 39 | void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len, gfp_t gfp) |
40 | { | 40 | { |
41 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 41 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
42 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 42 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
43 | nl80211_send_disassoc(rdev, dev, buf, len); | 43 | nl80211_send_disassoc(rdev, dev, buf, len, gfp); |
44 | } | 44 | } |
45 | EXPORT_SYMBOL(cfg80211_send_disassoc); | 45 | EXPORT_SYMBOL(cfg80211_send_disassoc); |
46 | 46 | ||
@@ -53,33 +53,33 @@ static void cfg80211_wext_disconnected(struct net_device *dev) | |||
53 | #endif | 53 | #endif |
54 | } | 54 | } |
55 | 55 | ||
56 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr) | 56 | void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp) |
57 | { | 57 | { |
58 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 58 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
59 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 59 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
60 | nl80211_send_auth_timeout(rdev, dev, addr); | 60 | nl80211_send_auth_timeout(rdev, dev, addr, gfp); |
61 | cfg80211_wext_disconnected(dev); | 61 | cfg80211_wext_disconnected(dev); |
62 | } | 62 | } |
63 | EXPORT_SYMBOL(cfg80211_send_auth_timeout); | 63 | EXPORT_SYMBOL(cfg80211_send_auth_timeout); |
64 | 64 | ||
65 | void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr) | 65 | void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr, gfp_t gfp) |
66 | { | 66 | { |
67 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 67 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
68 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 68 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
69 | nl80211_send_assoc_timeout(rdev, dev, addr); | 69 | nl80211_send_assoc_timeout(rdev, dev, addr, gfp); |
70 | cfg80211_wext_disconnected(dev); | 70 | cfg80211_wext_disconnected(dev); |
71 | } | 71 | } |
72 | EXPORT_SYMBOL(cfg80211_send_assoc_timeout); | 72 | EXPORT_SYMBOL(cfg80211_send_assoc_timeout); |
73 | 73 | ||
74 | void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | 74 | void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, |
75 | enum nl80211_key_type key_type, int key_id, | 75 | enum nl80211_key_type key_type, int key_id, |
76 | const u8 *tsc) | 76 | const u8 *tsc, gfp_t gfp) |
77 | { | 77 | { |
78 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; | 78 | struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; |
79 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); | 79 | struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); |
80 | #ifdef CONFIG_WIRELESS_EXT | 80 | #ifdef CONFIG_WIRELESS_EXT |
81 | union iwreq_data wrqu; | 81 | union iwreq_data wrqu; |
82 | char *buf = kmalloc(128, GFP_ATOMIC); | 82 | char *buf = kmalloc(128, gfp); |
83 | 83 | ||
84 | if (buf) { | 84 | if (buf) { |
85 | sprintf(buf, "MLME-MICHAELMICFAILURE.indication(" | 85 | sprintf(buf, "MLME-MICHAELMICFAILURE.indication(" |
@@ -93,6 +93,6 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | |||
93 | } | 93 | } |
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | nl80211_michael_mic_failure(rdev, dev, addr, key_type, key_id, tsc); | 96 | nl80211_michael_mic_failure(rdev, dev, addr, key_type, key_id, tsc, gfp); |
97 | } | 97 | } |
98 | EXPORT_SYMBOL(cfg80211_michael_mic_failure); | 98 | EXPORT_SYMBOL(cfg80211_michael_mic_failure); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 7946b82c5716..01523ba81baf 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -3832,12 +3832,12 @@ nla_put_failure: | |||
3832 | static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev, | 3832 | static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev, |
3833 | struct net_device *netdev, | 3833 | struct net_device *netdev, |
3834 | const u8 *buf, size_t len, | 3834 | const u8 *buf, size_t len, |
3835 | enum nl80211_commands cmd) | 3835 | enum nl80211_commands cmd, gfp_t gfp) |
3836 | { | 3836 | { |
3837 | struct sk_buff *msg; | 3837 | struct sk_buff *msg; |
3838 | void *hdr; | 3838 | void *hdr; |
3839 | 3839 | ||
3840 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); | 3840 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); |
3841 | if (!msg) | 3841 | if (!msg) |
3842 | return; | 3842 | return; |
3843 | 3843 | ||
@@ -3856,7 +3856,7 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev, | |||
3856 | return; | 3856 | return; |
3857 | } | 3857 | } |
3858 | 3858 | ||
3859 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, GFP_ATOMIC); | 3859 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); |
3860 | return; | 3860 | return; |
3861 | 3861 | ||
3862 | nla_put_failure: | 3862 | nla_put_failure: |
@@ -3865,42 +3865,45 @@ static void nl80211_send_mlme_event(struct cfg80211_registered_device *rdev, | |||
3865 | } | 3865 | } |
3866 | 3866 | ||
3867 | void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, | 3867 | void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, |
3868 | struct net_device *netdev, const u8 *buf, size_t len) | 3868 | struct net_device *netdev, const u8 *buf, |
3869 | size_t len, gfp_t gfp) | ||
3869 | { | 3870 | { |
3870 | nl80211_send_mlme_event(rdev, netdev, buf, len, | 3871 | nl80211_send_mlme_event(rdev, netdev, buf, len, |
3871 | NL80211_CMD_AUTHENTICATE); | 3872 | NL80211_CMD_AUTHENTICATE, gfp); |
3872 | } | 3873 | } |
3873 | 3874 | ||
3874 | void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, | 3875 | void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, |
3875 | struct net_device *netdev, const u8 *buf, | 3876 | struct net_device *netdev, const u8 *buf, |
3876 | size_t len) | 3877 | size_t len, gfp_t gfp) |
3877 | { | 3878 | { |
3878 | nl80211_send_mlme_event(rdev, netdev, buf, len, NL80211_CMD_ASSOCIATE); | 3879 | nl80211_send_mlme_event(rdev, netdev, buf, len, |
3880 | NL80211_CMD_ASSOCIATE, gfp); | ||
3879 | } | 3881 | } |
3880 | 3882 | ||
3881 | void nl80211_send_deauth(struct cfg80211_registered_device *rdev, | 3883 | void nl80211_send_deauth(struct cfg80211_registered_device *rdev, |
3882 | struct net_device *netdev, const u8 *buf, size_t len) | 3884 | struct net_device *netdev, const u8 *buf, |
3885 | size_t len, gfp_t gfp) | ||
3883 | { | 3886 | { |
3884 | nl80211_send_mlme_event(rdev, netdev, buf, len, | 3887 | nl80211_send_mlme_event(rdev, netdev, buf, len, |
3885 | NL80211_CMD_DEAUTHENTICATE); | 3888 | NL80211_CMD_DEAUTHENTICATE, gfp); |
3886 | } | 3889 | } |
3887 | 3890 | ||
3888 | void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, | 3891 | void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, |
3889 | struct net_device *netdev, const u8 *buf, | 3892 | struct net_device *netdev, const u8 *buf, |
3890 | size_t len) | 3893 | size_t len, gfp_t gfp) |
3891 | { | 3894 | { |
3892 | nl80211_send_mlme_event(rdev, netdev, buf, len, | 3895 | nl80211_send_mlme_event(rdev, netdev, buf, len, |
3893 | NL80211_CMD_DISASSOCIATE); | 3896 | NL80211_CMD_DISASSOCIATE, gfp); |
3894 | } | 3897 | } |
3895 | 3898 | ||
3896 | static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, | 3899 | static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, |
3897 | struct net_device *netdev, int cmd, | 3900 | struct net_device *netdev, int cmd, |
3898 | const u8 *addr) | 3901 | const u8 *addr, gfp_t gfp) |
3899 | { | 3902 | { |
3900 | struct sk_buff *msg; | 3903 | struct sk_buff *msg; |
3901 | void *hdr; | 3904 | void *hdr; |
3902 | 3905 | ||
3903 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); | 3906 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); |
3904 | if (!msg) | 3907 | if (!msg) |
3905 | return; | 3908 | return; |
3906 | 3909 | ||
@@ -3920,7 +3923,7 @@ static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, | |||
3920 | return; | 3923 | return; |
3921 | } | 3924 | } |
3922 | 3925 | ||
3923 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, GFP_ATOMIC); | 3926 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); |
3924 | return; | 3927 | return; |
3925 | 3928 | ||
3926 | nla_put_failure: | 3929 | nla_put_failure: |
@@ -3929,16 +3932,19 @@ static void nl80211_send_mlme_timeout(struct cfg80211_registered_device *rdev, | |||
3929 | } | 3932 | } |
3930 | 3933 | ||
3931 | void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev, | 3934 | void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev, |
3932 | struct net_device *netdev, const u8 *addr) | 3935 | struct net_device *netdev, const u8 *addr, |
3936 | gfp_t gfp) | ||
3933 | { | 3937 | { |
3934 | nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_AUTHENTICATE, | 3938 | nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_AUTHENTICATE, |
3935 | addr); | 3939 | addr, gfp); |
3936 | } | 3940 | } |
3937 | 3941 | ||
3938 | void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev, | 3942 | void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev, |
3939 | struct net_device *netdev, const u8 *addr) | 3943 | struct net_device *netdev, const u8 *addr, |
3944 | gfp_t gfp) | ||
3940 | { | 3945 | { |
3941 | nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_ASSOCIATE, addr); | 3946 | nl80211_send_mlme_timeout(rdev, netdev, NL80211_CMD_ASSOCIATE, |
3947 | addr, gfp); | ||
3942 | } | 3948 | } |
3943 | 3949 | ||
3944 | void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, | 3950 | void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, |
@@ -3978,12 +3984,12 @@ void nl80211_send_ibss_bssid(struct cfg80211_registered_device *rdev, | |||
3978 | void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, | 3984 | void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, |
3979 | struct net_device *netdev, const u8 *addr, | 3985 | struct net_device *netdev, const u8 *addr, |
3980 | enum nl80211_key_type key_type, int key_id, | 3986 | enum nl80211_key_type key_type, int key_id, |
3981 | const u8 *tsc) | 3987 | const u8 *tsc, gfp_t gfp) |
3982 | { | 3988 | { |
3983 | struct sk_buff *msg; | 3989 | struct sk_buff *msg; |
3984 | void *hdr; | 3990 | void *hdr; |
3985 | 3991 | ||
3986 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); | 3992 | msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); |
3987 | if (!msg) | 3993 | if (!msg) |
3988 | return; | 3994 | return; |
3989 | 3995 | ||
@@ -4007,7 +4013,7 @@ void nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, | |||
4007 | return; | 4013 | return; |
4008 | } | 4014 | } |
4009 | 4015 | ||
4010 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, GFP_ATOMIC); | 4016 | genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); |
4011 | return; | 4017 | return; |
4012 | 4018 | ||
4013 | nla_put_failure: | 4019 | nla_put_failure: |
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h index cf0d271f7e1f..662c216e8d4f 100644 --- a/net/wireless/nl80211.h +++ b/net/wireless/nl80211.h | |||
@@ -15,27 +15,27 @@ void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, | |||
15 | void nl80211_send_reg_change_event(struct regulatory_request *request); | 15 | void nl80211_send_reg_change_event(struct regulatory_request *request); |
16 | void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, | 16 | void nl80211_send_rx_auth(struct cfg80211_registered_device *rdev, |
17 | struct net_device *netdev, | 17 | struct net_device *netdev, |
18 | const u8 *buf, size_t len); | 18 | const u8 *buf, size_t len, gfp_t gfp); |
19 | void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, | 19 | void nl80211_send_rx_assoc(struct cfg80211_registered_device *rdev, |
20 | struct net_device *netdev, | 20 | struct net_device *netdev, |
21 | const u8 *buf, size_t len); | 21 | const u8 *buf, size_t len, gfp_t gfp); |
22 | void nl80211_send_deauth(struct cfg80211_registered_device *rdev, | 22 | void nl80211_send_deauth(struct cfg80211_registered_device *rdev, |
23 | struct net_device *netdev, | 23 | struct net_device *netdev, |
24 | const u8 *buf, size_t len); | 24 | const u8 *buf, size_t len, gfp_t gfp); |
25 | void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, | 25 | void nl80211_send_disassoc(struct cfg80211_registered_device *rdev, |
26 | struct net_device *netdev, | 26 | struct net_device *netdev, |
27 | const u8 *buf, size_t len); | 27 | const u8 *buf, size_t len, gfp_t gfp); |
28 | void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev, | 28 | void nl80211_send_auth_timeout(struct cfg80211_registered_device *rdev, |
29 | struct net_device *netdev, | 29 | struct net_device *netdev, |
30 | const u8 *addr); | 30 | const u8 *addr, gfp_t gfp); |
31 | void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev, | 31 | void nl80211_send_assoc_timeout(struct cfg80211_registered_device *rdev, |
32 | struct net_device *netdev, | 32 | struct net_device *netdev, |
33 | const u8 *addr); | 33 | const u8 *addr, gfp_t gfp); |
34 | void | 34 | void |
35 | nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, | 35 | nl80211_michael_mic_failure(struct cfg80211_registered_device *rdev, |
36 | struct net_device *netdev, const u8 *addr, | 36 | struct net_device *netdev, const u8 *addr, |
37 | enum nl80211_key_type key_type, | 37 | enum nl80211_key_type key_type, |
38 | int key_id, const u8 *tsc); | 38 | int key_id, const u8 *tsc, gfp_t gfp); |
39 | 39 | ||
40 | void | 40 | void |
41 | nl80211_send_beacon_hint_event(struct wiphy *wiphy, | 41 | nl80211_send_beacon_hint_event(struct wiphy *wiphy, |