aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/tg3.c114
-rw-r--r--drivers/net/tg3.h1
-rw-r--r--include/linux/genetlink.h13
-rw-r--r--include/linux/netlink.h2
-rw-r--r--include/net/genetlink.h22
-rw-r--r--net/ax25/af_ax25.c2
-rw-r--r--net/bluetooth/hci_core.c2
-rw-r--r--net/core/dev.c2
-rw-r--r--net/core/rtnetlink.c2
-rw-r--r--net/core/sock.c2
-rw-r--r--net/dccp/ccids/lib/loss_interval.c2
-rw-r--r--net/ipv4/fib_frontend.c2
-rw-r--r--net/ipv4/ip_forward.c2
-rw-r--r--net/ipv4/tcp_output.c2
-rw-r--r--net/mac80211/Makefile1
-rw-r--r--net/mac80211/debugfs_netdev.c9
-rw-r--r--net/mac80211/ieee80211.c7
-rw-r--r--net/mac80211/ieee80211_i.h5
-rw-r--r--net/mac80211/ieee80211_ioctl.c133
-rw-r--r--net/mac80211/ieee80211_sta.c6
-rw-r--r--net/mac80211/regdomain.c158
-rw-r--r--net/netfilter/nf_conntrack_standalone.c2
-rw-r--r--net/netfilter/nf_log.c2
-rw-r--r--net/netlink/af_netlink.c161
-rw-r--r--net/netlink/genetlink.c235
-rw-r--r--net/netrom/af_netrom.c2
-rw-r--r--net/packet/af_packet.c2
-rw-r--r--net/rfkill/rfkill-input.c2
-rw-r--r--net/rfkill/rfkill.c2
-rw-r--r--net/rose/af_rose.c2
-rw-r--r--net/rxrpc/af_rxrpc.c10
-rw-r--r--net/sctp/sm_statefuns.c2
-rw-r--r--net/sctp/socket.c4
-rw-r--r--net/sunrpc/auth_gss/gss_krb5_crypto.c2
-rw-r--r--net/tipc/socket.c12
-rw-r--r--net/xfrm/xfrm_policy.c2
-rw-r--r--net/xfrm/xfrm_state.c2
37 files changed, 663 insertions, 270 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 5ee14764fd7..887b9a5cfe4 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
64 64
65#define DRV_MODULE_NAME "tg3" 65#define DRV_MODULE_NAME "tg3"
66#define PFX DRV_MODULE_NAME ": " 66#define PFX DRV_MODULE_NAME ": "
67#define DRV_MODULE_VERSION "3.78" 67#define DRV_MODULE_VERSION "3.79"
68#define DRV_MODULE_RELDATE "July 11, 2007" 68#define DRV_MODULE_RELDATE "July 18, 2007"
69 69
70#define TG3_DEF_MAC_MODE 0 70#define TG3_DEF_MAC_MODE 0
71#define TG3_DEF_RX_MODE 0 71#define TG3_DEF_RX_MODE 0
@@ -4847,6 +4847,59 @@ static int tg3_poll_fw(struct tg3 *tp)
4847 return 0; 4847 return 0;
4848} 4848}
4849 4849
4850/* Save PCI command register before chip reset */
4851static void tg3_save_pci_state(struct tg3 *tp)
4852{
4853 u32 val;
4854
4855 pci_read_config_dword(tp->pdev, TG3PCI_COMMAND, &val);
4856 tp->pci_cmd = val;
4857}
4858
4859/* Restore PCI state after chip reset */
4860static void tg3_restore_pci_state(struct tg3 *tp)
4861{
4862 u32 val;
4863
4864 /* Re-enable indirect register accesses. */
4865 pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
4866 tp->misc_host_ctrl);
4867
4868 /* Set MAX PCI retry to zero. */
4869 val = (PCISTATE_ROM_ENABLE | PCISTATE_ROM_RETRY_ENABLE);
4870 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
4871 (tp->tg3_flags & TG3_FLAG_PCIX_MODE))
4872 val |= PCISTATE_RETRY_SAME_DMA;
4873 pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, val);
4874
4875 pci_write_config_dword(tp->pdev, TG3PCI_COMMAND, tp->pci_cmd);
4876
4877 /* Make sure PCI-X relaxed ordering bit is clear. */
4878 pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val);
4879 val &= ~PCIX_CAPS_RELAXED_ORDERING;
4880 pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val);
4881
4882 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) {
4883 u32 val;
4884
4885 /* Chip reset on 5780 will reset MSI enable bit,
4886 * so need to restore it.
4887 */
4888 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
4889 u16 ctrl;
4890
4891 pci_read_config_word(tp->pdev,
4892 tp->msi_cap + PCI_MSI_FLAGS,
4893 &ctrl);
4894 pci_write_config_word(tp->pdev,
4895 tp->msi_cap + PCI_MSI_FLAGS,
4896 ctrl | PCI_MSI_FLAGS_ENABLE);
4897 val = tr32(MSGINT_MODE);
4898 tw32(MSGINT_MODE, val | MSGINT_MODE_ENABLE);
4899 }
4900 }
4901}
4902
4850static void tg3_stop_fw(struct tg3 *); 4903static void tg3_stop_fw(struct tg3 *);
4851 4904
4852/* tp->lock is held. */ 4905/* tp->lock is held. */
@@ -4863,6 +4916,12 @@ static int tg3_chip_reset(struct tg3 *tp)
4863 */ 4916 */
4864 tp->nvram_lock_cnt = 0; 4917 tp->nvram_lock_cnt = 0;
4865 4918
4919 /* GRC_MISC_CFG core clock reset will clear the memory
4920 * enable bit in PCI register 4 and the MSI enable bit
4921 * on some chips, so we save relevant registers here.
4922 */
4923 tg3_save_pci_state(tp);
4924
4866 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || 4925 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 ||
4867 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || 4926 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 ||
4868 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787) 4927 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5787)
@@ -4961,50 +5020,14 @@ static int tg3_chip_reset(struct tg3 *tp)
4961 pci_write_config_dword(tp->pdev, 0xd8, 0xf5000); 5020 pci_write_config_dword(tp->pdev, 0xd8, 0xf5000);
4962 } 5021 }
4963 5022
4964 /* Re-enable indirect register accesses. */ 5023 tg3_restore_pci_state(tp);
4965 pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL,
4966 tp->misc_host_ctrl);
4967
4968 /* Set MAX PCI retry to zero. */
4969 val = (PCISTATE_ROM_ENABLE | PCISTATE_ROM_RETRY_ENABLE);
4970 if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 &&
4971 (tp->tg3_flags & TG3_FLAG_PCIX_MODE))
4972 val |= PCISTATE_RETRY_SAME_DMA;
4973 pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, val);
4974
4975 pci_restore_state(tp->pdev);
4976 5024
4977 tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING; 5025 tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING;
4978 5026
4979 /* Make sure PCI-X relaxed ordering bit is clear. */ 5027 val = 0;
4980 pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); 5028 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS)
4981 val &= ~PCIX_CAPS_RELAXED_ORDERING;
4982 pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val);
4983
4984 if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) {
4985 u32 val;
4986
4987 /* Chip reset on 5780 will reset MSI enable bit,
4988 * so need to restore it.
4989 */
4990 if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) {
4991 u16 ctrl;
4992
4993 pci_read_config_word(tp->pdev,
4994 tp->msi_cap + PCI_MSI_FLAGS,
4995 &ctrl);
4996 pci_write_config_word(tp->pdev,
4997 tp->msi_cap + PCI_MSI_FLAGS,
4998 ctrl | PCI_MSI_FLAGS_ENABLE);
4999 val = tr32(MSGINT_MODE);
5000 tw32(MSGINT_MODE, val | MSGINT_MODE_ENABLE);
5001 }
5002
5003 val = tr32(MEMARB_MODE); 5029 val = tr32(MEMARB_MODE);
5004 tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); 5030 tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE);
5005
5006 } else
5007 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
5008 5031
5009 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A3) { 5032 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A3) {
5010 tg3_stop_fw(tp); 5033 tg3_stop_fw(tp);
@@ -11978,7 +12001,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
11978 */ 12001 */
11979 if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) || 12002 if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) ||
11980 (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 12003 (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) {
11981 pci_save_state(tp->pdev);
11982 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 12004 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE);
11983 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 12005 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1);
11984 } 12006 }
@@ -12007,12 +12029,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
12007 12029
12008 tg3_init_coal(tp); 12030 tg3_init_coal(tp);
12009 12031
12010 /* Now that we have fully setup the chip, save away a snapshot
12011 * of the PCI config space. We need to restore this after
12012 * GRC_MISC_CFG core clock resets and some resume events.
12013 */
12014 pci_save_state(tp->pdev);
12015
12016 pci_set_drvdata(pdev, dev); 12032 pci_set_drvdata(pdev, dev);
12017 12033
12018 err = register_netdev(dev); 12034 err = register_netdev(dev);
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index d84e75e7365..5c21f49026c 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2345,6 +2345,7 @@ struct tg3 {
2345#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */ 2345#define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */
2346 2346
2347 u32 led_ctrl; 2347 u32 led_ctrl;
2348 u32 pci_cmd;
2348 2349
2349 char board_part_number[24]; 2350 char board_part_number[24];
2350 char fw_ver[16]; 2351 char fw_ver[16];
diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h
index f7a93770e1b..7da02c93002 100644
--- a/include/linux/genetlink.h
+++ b/include/linux/genetlink.h
@@ -39,6 +39,9 @@ enum {
39 CTRL_CMD_NEWOPS, 39 CTRL_CMD_NEWOPS,
40 CTRL_CMD_DELOPS, 40 CTRL_CMD_DELOPS,
41 CTRL_CMD_GETOPS, 41 CTRL_CMD_GETOPS,
42 CTRL_CMD_NEWMCAST_GRP,
43 CTRL_CMD_DELMCAST_GRP,
44 CTRL_CMD_GETMCAST_GRP, /* unused */
42 __CTRL_CMD_MAX, 45 __CTRL_CMD_MAX,
43}; 46};
44 47
@@ -52,6 +55,7 @@ enum {
52 CTRL_ATTR_HDRSIZE, 55 CTRL_ATTR_HDRSIZE,
53 CTRL_ATTR_MAXATTR, 56 CTRL_ATTR_MAXATTR,
54 CTRL_ATTR_OPS, 57 CTRL_ATTR_OPS,
58 CTRL_ATTR_MCAST_GROUPS,
55 __CTRL_ATTR_MAX, 59 __CTRL_ATTR_MAX,
56}; 60};
57 61
@@ -66,4 +70,13 @@ enum {
66 70
67#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) 71#define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1)
68 72
73enum {
74 CTRL_ATTR_MCAST_GRP_UNSPEC,
75 CTRL_ATTR_MCAST_GRP_NAME,
76 CTRL_ATTR_MCAST_GRP_ID,
77 __CTRL_ATTR_MCAST_GRP_MAX,
78};
79
80#define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1)
81
69#endif /* __LINUX_GENERIC_NETLINK_H */ 82#endif /* __LINUX_GENERIC_NETLINK_H */
diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 2e23353c28a..83d8239f0cc 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -161,6 +161,8 @@ extern struct sock *netlink_kernel_create(int unit, unsigned int groups,
161 void (*input)(struct sock *sk, int len), 161 void (*input)(struct sock *sk, int len),
162 struct mutex *cb_mutex, 162 struct mutex *cb_mutex,
163 struct module *module); 163 struct module *module);
164extern int netlink_change_ngroups(struct sock *sk, unsigned int groups);
165extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group);
164extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 166extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err);
165extern int netlink_has_listeners(struct sock *sk, unsigned int group); 167extern int netlink_has_listeners(struct sock *sk, unsigned int group);
166extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock); 168extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index b6eaca122db..decdda54682 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -5,6 +5,22 @@
5#include <net/netlink.h> 5#include <net/netlink.h>
6 6
7/** 7/**
8 * struct genl_multicast_group - generic netlink multicast group
9 * @name: name of the multicast group, names are per-family
10 * @id: multicast group ID, assigned by the core, to use with
11 * genlmsg_multicast().
12 * @list: list entry for linking
13 * @family: pointer to family, need not be set before registering
14 */
15struct genl_multicast_group
16{
17 struct genl_family *family; /* private */
18 struct list_head list; /* private */
19 char name[GENL_NAMSIZ];
20 u32 id;
21};
22
23/**
8 * struct genl_family - generic netlink family 24 * struct genl_family - generic netlink family
9 * @id: protocol family idenfitier 25 * @id: protocol family idenfitier
10 * @hdrsize: length of user specific header in bytes 26 * @hdrsize: length of user specific header in bytes
@@ -14,6 +30,7 @@
14 * @attrbuf: buffer to store parsed attributes 30 * @attrbuf: buffer to store parsed attributes
15 * @ops_list: list of all assigned operations 31 * @ops_list: list of all assigned operations
16 * @family_list: family list 32 * @family_list: family list
33 * @mcast_groups: multicast groups list
17 */ 34 */
18struct genl_family 35struct genl_family
19{ 36{
@@ -25,6 +42,7 @@ struct genl_family
25 struct nlattr ** attrbuf; /* private */ 42 struct nlattr ** attrbuf; /* private */
26 struct list_head ops_list; /* private */ 43 struct list_head ops_list; /* private */
27 struct list_head family_list; /* private */ 44 struct list_head family_list; /* private */
45 struct list_head mcast_groups; /* private */
28}; 46};
29 47
30/** 48/**
@@ -73,6 +91,10 @@ extern int genl_register_family(struct genl_family *family);
73extern int genl_unregister_family(struct genl_family *family); 91extern int genl_unregister_family(struct genl_family *family);
74extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 92extern int genl_register_ops(struct genl_family *, struct genl_ops *ops);
75extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 93extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
94extern int genl_register_mc_group(struct genl_family *family,
95 struct genl_multicast_group *grp);
96extern void genl_unregister_mc_group(struct genl_family *family,
97 struct genl_multicast_group *grp);
76 98
77extern struct sock *genl_sock; 99extern struct sock *genl_sock;
78 100
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index c83cf843297..dae2a42d3d8 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1262,7 +1262,7 @@ static int __must_check ax25_connect(struct socket *sock,
1262 1262
1263 for (;;) { 1263 for (;;) {
1264 prepare_to_wait(sk->sk_sleep, &wait, 1264 prepare_to_wait(sk->sk_sleep, &wait,
1265 TASK_INTERRUPTIBLE); 1265 TASK_INTERRUPTIBLE);
1266 if (sk->sk_state != TCP_SYN_SENT) 1266 if (sk->sk_state != TCP_SYN_SENT)
1267 break; 1267 break;
1268 if (!signal_pending(current)) { 1268 if (!signal_pending(current)) {
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index f6d867e0179..63caa414945 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -982,7 +982,7 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count)
982 982
983 skb->dev = (void *) hdev; 983 skb->dev = (void *) hdev;
984 bt_cb(skb)->pkt_type = type; 984 bt_cb(skb)->pkt_type = type;
985 985
986 __reassembly(hdev, type) = skb; 986 __reassembly(hdev, type) = skb;
987 987
988 scb = (void *) skb->cb; 988 scb = (void *) skb->cb;
diff --git a/net/core/dev.c b/net/core/dev.c
index 6357f54c8ff..38212c3f997 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2629,7 +2629,7 @@ void __dev_set_rx_mode(struct net_device *dev)
2629 return; 2629 return;
2630 2630
2631 if (!netif_device_present(dev)) 2631 if (!netif_device_present(dev))
2632 return; 2632 return;
2633 2633
2634 if (dev->set_rx_mode) 2634 if (dev->set_rx_mode)
2635 dev->set_rx_mode(dev); 2635 dev->set_rx_mode(dev);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 864cbdf31ed..06eccca8cb5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -98,7 +98,7 @@ int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len)
98} 98}
99 99
100int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr, 100int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr,
101 struct rtattr *rta, int len) 101 struct rtattr *rta, int len)
102{ 102{
103 if (RTA_PAYLOAD(rta) < len) 103 if (RTA_PAYLOAD(rta) < len)
104 return -1; 104 return -1;
diff --git a/net/core/sock.c b/net/core/sock.c
index 25d2557211c..239a08a6ff2 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -230,7 +230,7 @@ static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen)
230 warned++; 230 warned++;
231 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) " 231 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) "
232 "tries to set negative timeout\n", 232 "tries to set negative timeout\n",
233 current->comm, current->pid); 233 current->comm, current->pid);
234 return 0; 234 return 0;
235 } 235 }
236 *timeo_p = MAX_SCHEDULE_TIMEOUT; 236 *timeo_p = MAX_SCHEDULE_TIMEOUT;
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c
index 515225f3a46..dd0fc992b04 100644
--- a/net/dccp/ccids/lib/loss_interval.c
+++ b/net/dccp/ccids/lib/loss_interval.c
@@ -227,7 +227,7 @@ void dccp_li_update_li(struct sock *sk,
227 struct list_head *li_hist_list, 227 struct list_head *li_hist_list,
228 struct list_head *hist_list, 228 struct list_head *hist_list,
229 struct timeval *last_feedback, u16 s, u32 bytes_recv, 229 struct timeval *last_feedback, u16 s, u32 bytes_recv,
230 u32 previous_x_recv, u64 seq_loss, u8 win_loss) 230 u32 previous_x_recv, u64 seq_loss, u8 win_loss)
231{ 231{
232 struct dccp_li_hist_entry *head; 232 struct dccp_li_hist_entry *head;
233 u64 seq_temp; 233 u64 seq_temp;
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index 2eb909be804..eff6bce453e 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -817,7 +817,7 @@ static void nl_fib_input(struct sock *sk, int len)
817static void nl_fib_lookup_init(void) 817static void nl_fib_lookup_init(void)
818{ 818{
819 netlink_kernel_create(NETLINK_FIB_LOOKUP, 0, nl_fib_input, NULL, 819 netlink_kernel_create(NETLINK_FIB_LOOKUP, 0, nl_fib_input, NULL,
820 THIS_MODULE); 820 THIS_MODULE);
821} 821}
822 822
823static void fib_disable_ip(struct net_device *dev, int force) 823static void fib_disable_ip(struct net_device *dev, int force)
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 9cb04df0054..8c95cf09f87 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -86,7 +86,7 @@ int ip_forward(struct sk_buff *skb)
86 goto sr_failed; 86 goto sr_failed;
87 87
88 if (unlikely(skb->len > dst_mtu(&rt->u.dst) && 88 if (unlikely(skb->len > dst_mtu(&rt->u.dst) &&
89 (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) { 89 (ip_hdr(skb)->frag_off & htons(IP_DF))) && !skb->local_df) {
90 IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); 90 IP_INC_STATS(IPSTATS_MIB_FRAGFAILS);
91 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, 91 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
92 htonl(dst_mtu(&rt->u.dst))); 92 htonl(dst_mtu(&rt->u.dst)));
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 20aea1595c4..666d8a58d14 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1615,7 +1615,7 @@ u32 __tcp_select_window(struct sock *sk)
1615 if (window <= free_space - mss || window > free_space) 1615 if (window <= free_space - mss || window > free_space)
1616 window = (free_space/mss)*mss; 1616 window = (free_space/mss)*mss;
1617 else if (mss == full_space && 1617 else if (mss == full_space &&
1618 free_space > window + full_space/2) 1618 free_space > window + full_space/2)
1619 window = free_space; 1619 window = free_space;
1620 } 1620 }
1621 1621
diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile
index e9738dad2d7..a9c2d0787d4 100644
--- a/net/mac80211/Makefile
+++ b/net/mac80211/Makefile
@@ -13,6 +13,7 @@ mac80211-objs := \
13 ieee80211_iface.o \ 13 ieee80211_iface.o \
14 ieee80211_rate.o \ 14 ieee80211_rate.o \
15 michael.o \ 15 michael.o \
16 regdomain.o \
16 tkip.o \ 17 tkip.o \
17 aes_ccm.o \ 18 aes_ccm.o \
18 wme.o \ 19 wme.o \
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index a3e01d76d50..799a9208c4b 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -397,6 +397,8 @@ static int netdev_notify(struct notifier_block * nb,
397 void *ndev) 397 void *ndev)
398{ 398{
399 struct net_device *dev = ndev; 399 struct net_device *dev = ndev;
400 struct dentry *dir;
401 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
400 char buf[10+IFNAMSIZ]; 402 char buf[10+IFNAMSIZ];
401 403
402 if (state != NETDEV_CHANGENAME) 404 if (state != NETDEV_CHANGENAME)
@@ -408,10 +410,11 @@ static int netdev_notify(struct notifier_block * nb,
408 if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) 410 if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid)
409 return 0; 411 return 0;
410 412
411 /* TODO
412 sprintf(buf, "netdev:%s", dev->name); 413 sprintf(buf, "netdev:%s", dev->name);
413 debugfs_rename(IEEE80211_DEV_TO_SUB_IF(dev)->debugfsdir, buf); 414 dir = sdata->debugfsdir;
414 */ 415 if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf))
416 printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs "
417 "dir to %s\n", buf);
415 418
416 return 0; 419 return 0;
417} 420}
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c
index 2ddf4ef4065..c944b17d0fc 100644
--- a/net/mac80211/ieee80211.c
+++ b/net/mac80211/ieee80211.c
@@ -4986,8 +4986,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
4986 * and we need some headroom for passing the frame to monitor 4986 * and we need some headroom for passing the frame to monitor
4987 * interfaces, but never both at the same time. 4987 * interfaces, but never both at the same time.
4988 */ 4988 */
4989 local->tx_headroom = max(local->hw.extra_tx_headroom, 4989 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
4990 sizeof(struct ieee80211_tx_status_rtap_hdr)); 4990 sizeof(struct ieee80211_tx_status_rtap_hdr));
4991 4991
4992 debugfs_hw_add(local); 4992 debugfs_hw_add(local);
4993 4993
@@ -5095,7 +5095,7 @@ int ieee80211_register_hwmode(struct ieee80211_hw *hw,
5095 } 5095 }
5096 5096
5097 if (!(hw->flags & IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED)) 5097 if (!(hw->flags & IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED))
5098 ieee80211_init_client(local->mdev); 5098 ieee80211_set_default_regdomain(mode);
5099 5099
5100 return 0; 5100 return 0;
5101} 5101}
@@ -5246,6 +5246,7 @@ static int __init ieee80211_init(void)
5246 } 5246 }
5247 5247
5248 ieee80211_debugfs_netdev_init(); 5248 ieee80211_debugfs_netdev_init();
5249 ieee80211_regdomain_init();
5249 5250
5250 return 0; 5251 return 0;
5251} 5252}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 055a2a91218..6f7bae7ef9c 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -759,7 +759,6 @@ void ieee80211_update_default_wep_only(struct ieee80211_local *local);
759/* ieee80211_ioctl.c */ 759/* ieee80211_ioctl.c */
760int ieee80211_set_compression(struct ieee80211_local *local, 760int ieee80211_set_compression(struct ieee80211_local *local,
761 struct net_device *dev, struct sta_info *sta); 761 struct net_device *dev, struct sta_info *sta);
762int ieee80211_init_client(struct net_device *dev);
763int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq); 762int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq);
764/* ieee80211_sta.c */ 763/* ieee80211_sta.c */
765void ieee80211_sta_timer(unsigned long data); 764void ieee80211_sta_timer(unsigned long data);
@@ -798,6 +797,10 @@ void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
798int ieee80211_if_add_mgmt(struct ieee80211_local *local); 797int ieee80211_if_add_mgmt(struct ieee80211_local *local);
799void ieee80211_if_del_mgmt(struct ieee80211_local *local); 798void ieee80211_if_del_mgmt(struct ieee80211_local *local);
800 799
800/* regdomain.c */
801void ieee80211_regdomain_init(void);
802void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode);
803
801/* for wiphy privid */ 804/* for wiphy privid */
802extern void *mac80211_wiphy_privid; 805extern void *mac80211_wiphy_privid;
803 806
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 5918dd079e1..d0e1ab5589d 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -27,20 +27,6 @@
27#include "aes_ccm.h" 27#include "aes_ccm.h"
28#include "debugfs_key.h" 28#include "debugfs_key.h"
29 29
30static int ieee80211_regdom = 0x10; /* FCC */
31module_param(ieee80211_regdom, int, 0444);
32MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain; 64=MKK");
33
34/*
35 * If firmware is upgraded by the vendor, additional channels can be used based
36 * on the new Japanese regulatory rules. This is indicated by setting
37 * ieee80211_japan_5ghz module parameter to one when loading the 80211 kernel
38 * module.
39 */
40static int ieee80211_japan_5ghz /* = 0 */;
41module_param(ieee80211_japan_5ghz, int, 0444);
42MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz");
43
44static void ieee80211_set_hw_encryption(struct net_device *dev, 30static void ieee80211_set_hw_encryption(struct net_device *dev,
45 struct sta_info *sta, u8 addr[ETH_ALEN], 31 struct sta_info *sta, u8 addr[ETH_ALEN],
46 struct ieee80211_key *key) 32 struct ieee80211_key *key)
@@ -412,125 +398,6 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
412} 398}
413 399
414 400
415struct ieee80211_channel_range {
416 short start_freq;
417 short end_freq;
418 unsigned char power_level;
419 unsigned char antenna_max;
420};
421
422static const struct ieee80211_channel_range ieee80211_fcc_channels[] = {
423 { 2412, 2462, 27, 6 } /* IEEE 802.11b/g, channels 1..11 */,
424 { 5180, 5240, 17, 6 } /* IEEE 802.11a, channels 36..48 */,
425 { 5260, 5320, 23, 6 } /* IEEE 802.11a, channels 52..64 */,
426 { 5745, 5825, 30, 6 } /* IEEE 802.11a, channels 149..165, outdoor */,
427 { 0 }
428};
429
430static const struct ieee80211_channel_range ieee80211_mkk_channels[] = {
431 { 2412, 2472, 20, 6 } /* IEEE 802.11b/g, channels 1..13 */,
432 { 5170, 5240, 20, 6 } /* IEEE 802.11a, channels 34..48 */,
433 { 5260, 5320, 20, 6 } /* IEEE 802.11a, channels 52..64 */,
434 { 0 }
435};
436
437
438static const struct ieee80211_channel_range *channel_range =
439 ieee80211_fcc_channels;
440
441
442static void ieee80211_unmask_channel(struct net_device *dev, int mode,
443 struct ieee80211_channel *chan)
444{
445 int i;
446
447 chan->flag = 0;
448
449 if (ieee80211_regdom == 64 &&
450 (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) {
451 /* Do not allow Turbo modes in Japan. */
452 return;
453 }
454
455 for (i = 0; channel_range[i].start_freq; i++) {
456 const struct ieee80211_channel_range *r = &channel_range[i];
457 if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) {
458 if (ieee80211_regdom == 64 && !ieee80211_japan_5ghz &&
459 chan->freq >= 5260 && chan->freq <= 5320) {
460 /*
461 * Skip new channels in Japan since the
462 * firmware was not marked having been upgraded
463 * by the vendor.
464 */
465 continue;
466 }
467
468 if (ieee80211_regdom == 0x10 &&
469 (chan->freq == 5190 || chan->freq == 5210 ||
470 chan->freq == 5230)) {
471 /* Skip MKK channels when in FCC domain. */
472 continue;
473 }
474
475 chan->flag |= IEEE80211_CHAN_W_SCAN |
476 IEEE80211_CHAN_W_ACTIVE_SCAN |
477 IEEE80211_CHAN_W_IBSS;
478 chan->power_level = r->power_level;
479 chan->antenna_max = r->antenna_max;
480
481 if (ieee80211_regdom == 64 &&
482 (chan->freq == 5170 || chan->freq == 5190 ||
483 chan->freq == 5210 || chan->freq == 5230)) {
484 /*
485 * New regulatory rules in Japan have backwards
486 * compatibility with old channels in 5.15-5.25
487 * GHz band, but the station is not allowed to
488 * use active scan on these old channels.
489 */
490 chan->flag &= ~IEEE80211_CHAN_W_ACTIVE_SCAN;
491 }
492
493 if (ieee80211_regdom == 64 &&
494 (chan->freq == 5260 || chan->freq == 5280 ||
495 chan->freq == 5300 || chan->freq == 5320)) {
496 /*
497 * IBSS is not allowed on 5.25-5.35 GHz band
498 * due to radar detection requirements.
499 */
500 chan->flag &= ~IEEE80211_CHAN_W_IBSS;
501 }
502
503 break;
504 }
505 }
506}
507
508
509static int ieee80211_unmask_channels(struct net_device *dev)
510{
511 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
512 struct ieee80211_hw_mode *mode;
513 int c;
514
515 list_for_each_entry(mode, &local->modes_list, list) {
516 for (c = 0; c < mode->num_channels; c++) {
517 ieee80211_unmask_channel(dev, mode->mode,
518 &mode->channels[c]);
519 }
520 }
521 return 0;
522}
523
524
525int ieee80211_init_client(struct net_device *dev)
526{
527 if (ieee80211_regdom == 0x40)
528 channel_range = ieee80211_mkk_channels;
529 ieee80211_unmask_channels(dev);
530 return 0;
531}
532
533
534static int ieee80211_ioctl_siwmode(struct net_device *dev, 401static int ieee80211_ioctl_siwmode(struct net_device *dev,
535 struct iw_request_info *info, 402 struct iw_request_info *info,
536 __u32 *mode, char *extra) 403 __u32 *mode, char *extra)
diff --git a/net/mac80211/ieee80211_sta.c b/net/mac80211/ieee80211_sta.c
index 22b11786327..7ba352e3ffe 100644
--- a/net/mac80211/ieee80211_sta.c
+++ b/net/mac80211/ieee80211_sta.c
@@ -25,7 +25,6 @@
25#include <linux/wireless.h> 25#include <linux/wireless.h>
26#include <linux/random.h> 26#include <linux/random.h>
27#include <linux/etherdevice.h> 27#include <linux/etherdevice.h>
28#include <linux/rtnetlink.h>
29#include <net/iw_handler.h> 28#include <net/iw_handler.h>
30#include <asm/types.h> 29#include <asm/types.h>
31 30
@@ -2106,12 +2105,9 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2106 struct ieee80211_sta_bss *bss, *selected = NULL; 2105 struct ieee80211_sta_bss *bss, *selected = NULL;
2107 int top_rssi = 0, freq; 2106 int top_rssi = 0, freq;
2108 2107
2109 rtnl_lock();
2110
2111 if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel && 2108 if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel &&
2112 !ifsta->auto_ssid_sel) { 2109 !ifsta->auto_ssid_sel) {
2113 ifsta->state = IEEE80211_AUTHENTICATE; 2110 ifsta->state = IEEE80211_AUTHENTICATE;
2114 rtnl_unlock();
2115 ieee80211_sta_reset_auth(dev, ifsta); 2111 ieee80211_sta_reset_auth(dev, ifsta);
2116 return 0; 2112 return 0;
2117 } 2113 }
@@ -2154,7 +2150,6 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2154 ieee80211_sta_set_bssid(dev, selected->bssid); 2150 ieee80211_sta_set_bssid(dev, selected->bssid);
2155 ieee80211_rx_bss_put(dev, selected); 2151 ieee80211_rx_bss_put(dev, selected);
2156 ifsta->state = IEEE80211_AUTHENTICATE; 2152 ifsta->state = IEEE80211_AUTHENTICATE;
2157 rtnl_unlock();
2158 ieee80211_sta_reset_auth(dev, ifsta); 2153 ieee80211_sta_reset_auth(dev, ifsta);
2159 return 0; 2154 return 0;
2160 } else { 2155 } else {
@@ -2165,7 +2160,6 @@ static int ieee80211_sta_config_auth(struct net_device *dev,
2165 } else 2160 } else
2166 ifsta->state = IEEE80211_DISABLED; 2161 ifsta->state = IEEE80211_DISABLED;
2167 } 2162 }
2168 rtnl_unlock();
2169 return -1; 2163 return -1;
2170} 2164}
2171 2165
diff --git a/net/mac80211/regdomain.c b/net/mac80211/regdomain.c
new file mode 100644
index 00000000000..b697a2afbb4
--- /dev/null
+++ b/net/mac80211/regdomain.c
@@ -0,0 +1,158 @@
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10/*
11 * This regulatory domain control implementation is known to be incomplete
12 * and confusing. mac80211 regulatory domain control will be significantly
13 * reworked in the not-too-distant future.
14 *
15 * For now, drivers wishing to control which channels are and aren't available
16 * are advised as follows:
17 * - set the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag
18 * - continue to include *ALL* possible channels in the modes registered
19 * through ieee80211_register_hwmode()
20 * - for each allowable ieee80211_channel structure registered in the above
21 * call, set the flag member to some meaningful value such as
22 * IEEE80211_CHAN_W_SCAN | IEEE80211_CHAN_W_ACTIVE_SCAN |
23 * IEEE80211_CHAN_W_IBSS.
24 * - leave flag as 0 for non-allowable channels
25 *
26 * The usual implementation is for a driver to read a device EEPROM to
27 * determine which regulatory domain it should be operating under, then
28 * looking up the allowable channels in a driver-local table, then performing
29 * the above.
30 */
31
32#include <linux/module.h>
33#include <linux/netdevice.h>
34#include <net/mac80211.h>
35#include "ieee80211_i.h"
36
37static int ieee80211_regdom = 0x10; /* FCC */
38module_param(ieee80211_regdom, int, 0444);
39MODULE_PARM_DESC(ieee80211_regdom, "IEEE 802.11 regulatory domain; 64=MKK");
40
41/*
42 * If firmware is upgraded by the vendor, additional channels can be used based
43 * on the new Japanese regulatory rules. This is indicated by setting
44 * ieee80211_japan_5ghz module parameter to one when loading the 80211 kernel
45 * module.
46 */
47static int ieee80211_japan_5ghz /* = 0 */;
48module_param(ieee80211_japan_5ghz, int, 0444);
49MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz");
50
51
52struct ieee80211_channel_range {
53 short start_freq;
54 short end_freq;
55 unsigned char power_level;
56 unsigned char antenna_max;
57};
58
59static const struct ieee80211_channel_range ieee80211_fcc_channels[] = {
60 { 2412, 2462, 27, 6 } /* IEEE 802.11b/g, channels 1..11 */,
61 { 5180, 5240, 17, 6 } /* IEEE 802.11a, channels 36..48 */,
62 { 5260, 5320, 23, 6 } /* IEEE 802.11a, channels 52..64 */,
63 { 5745, 5825, 30, 6 } /* IEEE 802.11a, channels 149..165, outdoor */,
64 { 0 }
65};
66
67static const struct ieee80211_channel_range ieee80211_mkk_channels[] = {
68 { 2412, 2472, 20, 6 } /* IEEE 802.11b/g, channels 1..13 */,
69 { 5170, 5240, 20, 6 } /* IEEE 802.11a, channels 34..48 */,
70 { 5260, 5320, 20, 6 } /* IEEE 802.11a, channels 52..64 */,
71 { 0 }
72};
73
74
75static const struct ieee80211_channel_range *channel_range =
76 ieee80211_fcc_channels;
77
78
79static void ieee80211_unmask_channel(int mode, struct ieee80211_channel *chan)
80{
81 int i;
82
83 chan->flag = 0;
84
85 if (ieee80211_regdom == 64 &&
86 (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) {
87 /* Do not allow Turbo modes in Japan. */
88 return;
89 }
90
91 for (i = 0; channel_range[i].start_freq; i++) {
92 const struct ieee80211_channel_range *r = &channel_range[i];
93 if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) {
94 if (ieee80211_regdom == 64 && !ieee80211_japan_5ghz &&
95 chan->freq >= 5260 && chan->freq <= 5320) {
96 /*
97 * Skip new channels in Japan since the
98 * firmware was not marked having been upgraded
99 * by the vendor.
100 */
101 continue;
102 }
103
104 if (ieee80211_regdom == 0x10 &&
105 (chan->freq == 5190 || chan->freq == 5210 ||
106 chan->freq == 5230)) {
107 /* Skip MKK channels when in FCC domain. */
108 continue;
109 }
110
111 chan->flag |= IEEE80211_CHAN_W_SCAN |
112 IEEE80211_CHAN_W_ACTIVE_SCAN |
113 IEEE80211_CHAN_W_IBSS;
114 chan->power_level = r->power_level;
115 chan->antenna_max = r->antenna_max;
116
117 if (ieee80211_regdom == 64 &&
118 (chan->freq == 5170 || chan->freq == 5190 ||
119 chan->freq == 5210 || chan->freq == 5230)) {
120 /*
121 * New regulatory rules in Japan have backwards
122 * compatibility with old channels in 5.15-5.25
123 * GHz band, but the station is not allowed to
124 * use active scan on these old channels.
125 */
126 chan->flag &= ~IEEE80211_CHAN_W_ACTIVE_SCAN;
127 }
128
129 if (ieee80211_regdom == 64 &&
130 (chan->freq == 5260 || chan->freq == 5280 ||
131 chan->freq == 5300 || chan->freq == 5320)) {
132 /*
133 * IBSS is not allowed on 5.25-5.35 GHz band
134 * due to radar detection requirements.
135 */
136 chan->flag &= ~IEEE80211_CHAN_W_IBSS;
137 }
138
139 break;
140 }
141 }
142}
143
144
145void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode)
146{
147 int c;
148 for (c = 0; c < mode->num_channels; c++)
149 ieee80211_unmask_channel(mode->mode, &mode->channels[c]);
150}
151
152
153void ieee80211_regdomain_init(void)
154{
155 if (ieee80211_regdom == 0x40)
156 channel_range = ieee80211_mkk_channels;
157}
158
diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
index fc847cc63be..a4ce5e88799 100644
--- a/net/netfilter/nf_conntrack_standalone.c
+++ b/net/netfilter/nf_conntrack_standalone.c
@@ -181,7 +181,7 @@ static int ct_seq_show(struct seq_file *s, void *v)
181 181
182 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use))) 182 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use)))
183 return -ENOSPC; 183 return -ENOSPC;
184 184
185 return 0; 185 return 0;
186} 186}
187 187
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
index 94985792b79..d67c4fbf603 100644
--- a/net/netfilter/nf_log.c
+++ b/net/netfilter/nf_log.c
@@ -9,7 +9,7 @@
9 9
10#include "nf_internals.h" 10#include "nf_internals.h"
11 11
12/* Internal logging interface, which relies on the real 12/* Internal logging interface, which relies on the real
13 LOG target modules */ 13 LOG target modules */
14 14
15#define NF_LOG_PREFIXLEN 128 15#define NF_LOG_PREFIXLEN 128
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 641cfbc278d..5681ce3aebc 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -62,6 +62,7 @@
62#include <net/netlink.h> 62#include <net/netlink.h>
63 63
64#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8) 64#define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8)
65#define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long))
65 66
66struct netlink_sock { 67struct netlink_sock {
67 /* struct sock has to be the first member of netlink_sock */ 68 /* struct sock has to be the first member of netlink_sock */
@@ -314,10 +315,12 @@ netlink_update_listeners(struct sock *sk)
314 unsigned long mask; 315 unsigned long mask;
315 unsigned int i; 316 unsigned int i;
316 317
317 for (i = 0; i < NLGRPSZ(tbl->groups)/sizeof(unsigned long); i++) { 318 for (i = 0; i < NLGRPLONGS(tbl->groups); i++) {
318 mask = 0; 319 mask = 0;
319 sk_for_each_bound(sk, node, &tbl->mc_list) 320 sk_for_each_bound(sk, node, &tbl->mc_list) {
320 mask |= nlk_sk(sk)->groups[i]; 321 if (i < NLGRPLONGS(nlk_sk(sk)->ngroups))
322 mask |= nlk_sk(sk)->groups[i];
323 }
321 tbl->listeners[i] = mask; 324 tbl->listeners[i] = mask;
322 } 325 }
323 /* this function is only called with the netlink table "grabbed", which 326 /* this function is only called with the netlink table "grabbed", which
@@ -555,26 +558,37 @@ netlink_update_subscriptions(struct sock *sk, unsigned int subscriptions)
555 nlk->subscriptions = subscriptions; 558 nlk->subscriptions = subscriptions;
556} 559}
557 560
558static int netlink_alloc_groups(struct sock *sk) 561static int netlink_realloc_groups(struct sock *sk)
559{ 562{
560 struct netlink_sock *nlk = nlk_sk(sk); 563 struct netlink_sock *nlk = nlk_sk(sk);
561 unsigned int groups; 564 unsigned int groups;
565 unsigned long *new_groups;
562 int err = 0; 566 int err = 0;
563 567
564 netlink_lock_table(); 568 netlink_table_grab();
569
565 groups = nl_table[sk->sk_protocol].groups; 570 groups = nl_table[sk->sk_protocol].groups;
566 if (!nl_table[sk->sk_protocol].registered) 571 if (!nl_table[sk->sk_protocol].registered) {
567 err = -ENOENT; 572 err = -ENOENT;
568 netlink_unlock_table(); 573 goto out_unlock;
574 }
569 575
570 if (err) 576 if (nlk->ngroups >= groups)
571 return err; 577 goto out_unlock;
572 578
573 nlk->groups = kzalloc(NLGRPSZ(groups), GFP_KERNEL); 579 new_groups = krealloc(nlk->groups, NLGRPSZ(groups), GFP_ATOMIC);
574 if (nlk->groups == NULL) 580 if (new_groups == NULL) {
575 return -ENOMEM; 581 err = -ENOMEM;
582 goto out_unlock;
583 }
584 memset((char*)new_groups + NLGRPSZ(nlk->ngroups), 0,
585 NLGRPSZ(groups) - NLGRPSZ(nlk->ngroups));
586
587 nlk->groups = new_groups;
576 nlk->ngroups = groups; 588 nlk->ngroups = groups;
577 return 0; 589 out_unlock:
590 netlink_table_ungrab();
591 return err;
578} 592}
579 593
580static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len) 594static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len)
@@ -591,11 +605,9 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len
591 if (nladdr->nl_groups) { 605 if (nladdr->nl_groups) {
592 if (!netlink_capable(sock, NL_NONROOT_RECV)) 606 if (!netlink_capable(sock, NL_NONROOT_RECV))
593 return -EPERM; 607 return -EPERM;
594 if (nlk->groups == NULL) { 608 err = netlink_realloc_groups(sk);
595 err = netlink_alloc_groups(sk); 609 if (err)
596 if (err) 610 return err;
597 return err;
598 }
599 } 611 }
600 612
601 if (nlk->pid) { 613 if (nlk->pid) {
@@ -839,10 +851,18 @@ retry:
839int netlink_has_listeners(struct sock *sk, unsigned int group) 851int netlink_has_listeners(struct sock *sk, unsigned int group)
840{ 852{
841 int res = 0; 853 int res = 0;
854 unsigned long *listeners;
842 855
843 BUG_ON(!(nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET)); 856 BUG_ON(!(nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET));
857
858 rcu_read_lock();
859 listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners);
860
844 if (group - 1 < nl_table[sk->sk_protocol].groups) 861 if (group - 1 < nl_table[sk->sk_protocol].groups)
845 res = test_bit(group - 1, nl_table[sk->sk_protocol].listeners); 862 res = test_bit(group - 1, listeners);
863
864 rcu_read_unlock();
865
846 return res; 866 return res;
847} 867}
848EXPORT_SYMBOL_GPL(netlink_has_listeners); 868EXPORT_SYMBOL_GPL(netlink_has_listeners);
@@ -1007,6 +1027,23 @@ void netlink_set_err(struct sock *ssk, u32 pid, u32 group, int code)
1007 read_unlock(&nl_table_lock); 1027 read_unlock(&nl_table_lock);
1008} 1028}
1009 1029
1030/* must be called with netlink table grabbed */
1031static void netlink_update_socket_mc(struct netlink_sock *nlk,
1032 unsigned int group,
1033 int is_new)
1034{
1035 int old, new = !!is_new, subscriptions;
1036
1037 old = test_bit(group - 1, nlk->groups);
1038 subscriptions = nlk->subscriptions - old + new;
1039 if (new)
1040 __set_bit(group - 1, nlk->groups);
1041 else
1042 __clear_bit(group - 1, nlk->groups);
1043 netlink_update_subscriptions(&nlk->sk, subscriptions);
1044 netlink_update_listeners(&nlk->sk);
1045}
1046
1010static int netlink_setsockopt(struct socket *sock, int level, int optname, 1047static int netlink_setsockopt(struct socket *sock, int level, int optname,
1011 char __user *optval, int optlen) 1048 char __user *optval, int optlen)
1012{ 1049{
@@ -1032,27 +1069,16 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
1032 break; 1069 break;
1033 case NETLINK_ADD_MEMBERSHIP: 1070 case NETLINK_ADD_MEMBERSHIP:
1034 case NETLINK_DROP_MEMBERSHIP: { 1071 case NETLINK_DROP_MEMBERSHIP: {
1035 unsigned int subscriptions;
1036 int old, new = optname == NETLINK_ADD_MEMBERSHIP ? 1 : 0;
1037
1038 if (!netlink_capable(sock, NL_NONROOT_RECV)) 1072 if (!netlink_capable(sock, NL_NONROOT_RECV))
1039 return -EPERM; 1073 return -EPERM;
1040 if (nlk->groups == NULL) { 1074 err = netlink_realloc_groups(sk);
1041 err = netlink_alloc_groups(sk); 1075 if (err)
1042 if (err) 1076 return err;
1043 return err;
1044 }
1045 if (!val || val - 1 >= nlk->ngroups) 1077 if (!val || val - 1 >= nlk->ngroups)
1046 return -EINVAL; 1078 return -EINVAL;
1047 netlink_table_grab(); 1079 netlink_table_grab();
1048 old = test_bit(val - 1, nlk->groups); 1080 netlink_update_socket_mc(nlk, val,
1049 subscriptions = nlk->subscriptions - old + new; 1081 optname == NETLINK_ADD_MEMBERSHIP);
1050 if (new)
1051 __set_bit(val - 1, nlk->groups);
1052 else
1053 __clear_bit(val - 1, nlk->groups);
1054 netlink_update_subscriptions(sk, subscriptions);
1055 netlink_update_listeners(sk);
1056 netlink_table_ungrab(); 1082 netlink_table_ungrab();
1057 err = 0; 1083 err = 0;
1058 break; 1084 break;
@@ -1328,6 +1354,71 @@ out_sock_release:
1328 return NULL; 1354 return NULL;
1329} 1355}
1330 1356
1357/**
1358 * netlink_change_ngroups - change number of multicast groups
1359 *
1360 * This changes the number of multicast groups that are available
1361 * on a certain netlink family. Note that it is not possible to
1362 * change the number of groups to below 32. Also note that it does
1363 * not implicitly call netlink_clear_multicast_users() when the
1364 * number of groups is reduced.
1365 *
1366 * @sk: The kernel netlink socket, as returned by netlink_kernel_create().
1367 * @groups: The new number of groups.
1368 */
1369int netlink_change_ngroups(struct sock *sk, unsigned int groups)
1370{
1371 unsigned long *listeners, *old = NULL;
1372 struct netlink_table *tbl = &nl_table[sk->sk_protocol];
1373 int err = 0;
1374
1375 if (groups < 32)
1376 groups = 32;
1377
1378 netlink_table_grab();
1379 if (NLGRPSZ(tbl->groups) < NLGRPSZ(groups)) {
1380 listeners = kzalloc(NLGRPSZ(groups), GFP_ATOMIC);
1381 if (!listeners) {
1382 err = -ENOMEM;
1383 goto out_ungrab;
1384 }
1385 old = tbl->listeners;
1386 memcpy(listeners, old, NLGRPSZ(tbl->groups));
1387 rcu_assign_pointer(tbl->listeners, listeners);
1388 }
1389 tbl->groups = groups;
1390
1391 out_ungrab:
1392 netlink_table_ungrab();
1393 synchronize_rcu();
1394 kfree(old);
1395 return err;
1396}
1397EXPORT_SYMBOL(netlink_change_ngroups);
1398
1399/**
1400 * netlink_clear_multicast_users - kick off multicast listeners
1401 *
1402 * This function removes all listeners from the given group.
1403 * @ksk: The kernel netlink socket, as returned by
1404 * netlink_kernel_create().
1405 * @group: The multicast group to clear.
1406 */
1407void netlink_clear_multicast_users(struct sock *ksk, unsigned int group)
1408{
1409 struct sock *sk;
1410 struct hlist_node *node;
1411 struct netlink_table *tbl = &nl_table[ksk->sk_protocol];
1412
1413 netlink_table_grab();
1414
1415 sk_for_each_bound(sk, node, &tbl->mc_list)
1416 netlink_update_socket_mc(nlk_sk(sk), group, 0);
1417
1418 netlink_table_ungrab();
1419}
1420EXPORT_SYMBOL(netlink_clear_multicast_users);
1421
1331void netlink_set_nonroot(int protocol, unsigned int flags) 1422void netlink_set_nonroot(int protocol, unsigned int flags)
1332{ 1423{
1333 if ((unsigned int)protocol < MAX_LINKS) 1424 if ((unsigned int)protocol < MAX_LINKS)
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index b9ab62f938d..e146531faf1 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Authors: Jamal Hadi Salim 4 * Authors: Jamal Hadi Salim
5 * Thomas Graf <tgraf@suug.ch> 5 * Thomas Graf <tgraf@suug.ch>
6 * Johannes Berg <johannes@sipsolutions.net>
6 */ 7 */
7 8
8#include <linux/module.h> 9#include <linux/module.h>
@@ -13,6 +14,7 @@
13#include <linux/string.h> 14#include <linux/string.h>
14#include <linux/skbuff.h> 15#include <linux/skbuff.h>
15#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/bitmap.h>
16#include <net/sock.h> 18#include <net/sock.h>
17#include <net/genetlink.h> 19#include <net/genetlink.h>
18 20
@@ -42,6 +44,16 @@ static void genl_unlock(void)
42#define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1) 44#define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1)
43 45
44static struct list_head family_ht[GENL_FAM_TAB_SIZE]; 46static struct list_head family_ht[GENL_FAM_TAB_SIZE];
47/*
48 * Bitmap of multicast groups that are currently in use.
49 *
50 * To avoid an allocation at boot of just one unsigned long,
51 * declare it global instead.
52 * Bit 0 is marked as already used since group 0 is invalid.
53 */
54static unsigned long mc_group_start = 0x1;
55static unsigned long *mc_groups = &mc_group_start;
56static unsigned long mc_groups_longs = 1;
45 57
46static int genl_ctrl_event(int event, void *data); 58static int genl_ctrl_event(int event, void *data);
47 59
@@ -116,6 +128,114 @@ static inline u16 genl_generate_id(void)
116 return id_gen_idx; 128 return id_gen_idx;
117} 129}
118 130
131static struct genl_multicast_group notify_grp;
132
133/**
134 * genl_register_mc_group - register a multicast group
135 *
136 * Registers the specified multicast group and notifies userspace
137 * about the new group.
138 *
139 * Returns 0 on success or a negative error code.
140 *
141 * @family: The generic netlink family the group shall be registered for.
142 * @grp: The group to register, must have a name.
143 */
144int genl_register_mc_group(struct genl_family *family,
145 struct genl_multicast_group *grp)
146{
147 int id;
148 unsigned long *new_groups;
149 int err;
150
151 BUG_ON(grp->name[0] == '\0');
152
153 genl_lock();
154
155 /* special-case our own group */
156 if (grp == &notify_grp)
157 id = GENL_ID_CTRL;
158 else
159 id = find_first_zero_bit(mc_groups,
160 mc_groups_longs * BITS_PER_LONG);
161
162
163 if (id >= mc_groups_longs * BITS_PER_LONG) {
164 size_t nlen = (mc_groups_longs + 1) * sizeof(unsigned long);
165
166 if (mc_groups == &mc_group_start) {
167 new_groups = kzalloc(nlen, GFP_KERNEL);
168 if (!new_groups) {
169 err = -ENOMEM;
170 goto out;
171 }
172 mc_groups = new_groups;
173 *mc_groups = mc_group_start;
174 } else {
175 new_groups = krealloc(mc_groups, nlen, GFP_KERNEL);
176 if (!new_groups) {
177 err = -ENOMEM;
178 goto out;
179 }
180 mc_groups = new_groups;
181 mc_groups[mc_groups_longs] = 0;
182 }
183 mc_groups_longs++;
184 }
185
186 err = netlink_change_ngroups(genl_sock,
187 sizeof(unsigned long) * NETLINK_GENERIC);
188 if (err)
189 goto out;
190
191 grp->id = id;
192 set_bit(id, mc_groups);
193 list_add_tail(&grp->list, &family->mcast_groups);
194 grp->family = family;
195
196 genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP, grp);
197 out:
198 genl_unlock();
199 return 0;
200}
201EXPORT_SYMBOL(genl_register_mc_group);
202
203/**
204 * genl_unregister_mc_group - unregister a multicast group
205 *
206 * Unregisters the specified multicast group and notifies userspace
207 * about it. All current listeners on the group are removed.
208 *
209 * Note: It is not necessary to unregister all multicast groups before
210 * unregistering the family, unregistering the family will cause
211 * all assigned multicast groups to be unregistered automatically.
212 *
213 * @family: Generic netlink family the group belongs to.
214 * @grp: The group to unregister, must have been registered successfully
215 * previously.
216 */
217void genl_unregister_mc_group(struct genl_family *family,
218 struct genl_multicast_group *grp)
219{
220 BUG_ON(grp->family != family);
221 genl_lock();
222 netlink_clear_multicast_users(genl_sock, grp->id);
223 clear_bit(grp->id, mc_groups);
224 list_del(&grp->list);
225 genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp);
226 grp->id = 0;
227 grp->family = NULL;
228 genl_unlock();
229}
230
231static void genl_unregister_mc_groups(struct genl_family *family)
232{
233 struct genl_multicast_group *grp, *tmp;
234
235 list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list)
236 genl_unregister_mc_group(family, grp);
237}
238
119/** 239/**
120 * genl_register_ops - register generic netlink operations 240 * genl_register_ops - register generic netlink operations
121 * @family: generic netlink family 241 * @family: generic netlink family
@@ -216,6 +336,7 @@ int genl_register_family(struct genl_family *family)
216 goto errout; 336 goto errout;
217 337
218 INIT_LIST_HEAD(&family->ops_list); 338 INIT_LIST_HEAD(&family->ops_list);
339 INIT_LIST_HEAD(&family->mcast_groups);
219 340
220 genl_lock(); 341 genl_lock();
221 342
@@ -275,6 +396,8 @@ int genl_unregister_family(struct genl_family *family)
275{ 396{
276 struct genl_family *rc; 397 struct genl_family *rc;
277 398
399 genl_unregister_mc_groups(family);
400
278 genl_lock(); 401 genl_lock();
279 402
280 list_for_each_entry(rc, genl_family_chain(family->id), family_list) { 403 list_for_each_entry(rc, genl_family_chain(family->id), family_list) {
@@ -410,6 +533,67 @@ static int ctrl_fill_info(struct genl_family *family, u32 pid, u32 seq,
410 nla_nest_end(skb, nla_ops); 533 nla_nest_end(skb, nla_ops);
411 } 534 }
412 535
536 if (!list_empty(&family->mcast_groups)) {
537 struct genl_multicast_group *grp;
538 struct nlattr *nla_grps;
539 int idx = 1;
540
541 nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS);
542 if (nla_grps == NULL)
543 goto nla_put_failure;
544
545 list_for_each_entry(grp, &family->mcast_groups, list) {
546 struct nlattr *nest;
547
548 nest = nla_nest_start(skb, idx++);
549 if (nest == NULL)
550 goto nla_put_failure;
551
552 NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id);
553 NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME,
554 grp->name);
555
556 nla_nest_end(skb, nest);
557 }
558 nla_nest_end(skb, nla_grps);
559 }
560
561 return genlmsg_end(skb, hdr);
562
563nla_put_failure:
564 return genlmsg_cancel(skb, hdr);
565}
566
567static int ctrl_fill_mcgrp_info(struct genl_multicast_group *grp, u32 pid,
568 u32 seq, u32 flags, struct sk_buff *skb,
569 u8 cmd)
570{
571 void *hdr;
572 struct nlattr *nla_grps;
573 struct nlattr *nest;
574
575 hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd);
576 if (hdr == NULL)
577 return -1;
578
579 NLA_PUT_STRING(skb, CTRL_ATTR_FAMILY_NAME, grp->family->name);
580 NLA_PUT_U16(skb, CTRL_ATTR_FAMILY_ID, grp->family->id);
581
582 nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS);
583 if (nla_grps == NULL)
584 goto nla_put_failure;
585
586 nest = nla_nest_start(skb, 1);
587 if (nest == NULL)
588 goto nla_put_failure;
589
590 NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id);
591 NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME,
592 grp->name);
593
594 nla_nest_end(skb, nest);
595 nla_nest_end(skb, nla_grps);
596
413 return genlmsg_end(skb, hdr); 597 return genlmsg_end(skb, hdr);
414 598
415nla_put_failure: 599nla_put_failure:
@@ -453,8 +637,8 @@ errout:
453 return skb->len; 637 return skb->len;
454} 638}
455 639
456static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid, 640static struct sk_buff *ctrl_build_family_msg(struct genl_family *family,
457 int seq, u8 cmd) 641 u32 pid, int seq, u8 cmd)
458{ 642{
459 struct sk_buff *skb; 643 struct sk_buff *skb;
460 int err; 644 int err;
@@ -472,6 +656,25 @@ static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid,
472 return skb; 656 return skb;
473} 657}
474 658
659static struct sk_buff *ctrl_build_mcgrp_msg(struct genl_multicast_group *grp,
660 u32 pid, int seq, u8 cmd)
661{
662 struct sk_buff *skb;
663 int err;
664
665 skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
666 if (skb == NULL)
667 return ERR_PTR(-ENOBUFS);
668
669 err = ctrl_fill_mcgrp_info(grp, pid, seq, 0, skb, cmd);
670 if (err < 0) {
671 nlmsg_free(skb);
672 return ERR_PTR(err);
673 }
674
675 return skb;
676}
677
475static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = { 678static const struct nla_policy ctrl_policy[CTRL_ATTR_MAX+1] = {
476 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 }, 679 [CTRL_ATTR_FAMILY_ID] = { .type = NLA_U16 },
477 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING, 680 [CTRL_ATTR_FAMILY_NAME] = { .type = NLA_NUL_STRING,
@@ -501,8 +704,8 @@ static int ctrl_getfamily(struct sk_buff *skb, struct genl_info *info)
501 goto errout; 704 goto errout;
502 } 705 }
503 706
504 msg = ctrl_build_msg(res, info->snd_pid, info->snd_seq, 707 msg = ctrl_build_family_msg(res, info->snd_pid, info->snd_seq,
505 CTRL_CMD_NEWFAMILY); 708 CTRL_CMD_NEWFAMILY);
506 if (IS_ERR(msg)) { 709 if (IS_ERR(msg)) {
507 err = PTR_ERR(msg); 710 err = PTR_ERR(msg);
508 goto errout; 711 goto errout;
@@ -523,7 +726,15 @@ static int genl_ctrl_event(int event, void *data)
523 switch (event) { 726 switch (event) {
524 case CTRL_CMD_NEWFAMILY: 727 case CTRL_CMD_NEWFAMILY:
525 case CTRL_CMD_DELFAMILY: 728 case CTRL_CMD_DELFAMILY:
526 msg = ctrl_build_msg(data, 0, 0, event); 729 msg = ctrl_build_family_msg(data, 0, 0, event);
730 if (IS_ERR(msg))
731 return PTR_ERR(msg);
732
733 genlmsg_multicast(msg, 0, GENL_ID_CTRL, GFP_KERNEL);
734 break;
735 case CTRL_CMD_NEWMCAST_GRP:
736 case CTRL_CMD_DELMCAST_GRP:
737 msg = ctrl_build_mcgrp_msg(data, 0, 0, event);
527 if (IS_ERR(msg)) 738 if (IS_ERR(msg))
528 return PTR_ERR(msg); 739 return PTR_ERR(msg);
529 740
@@ -541,6 +752,10 @@ static struct genl_ops genl_ctrl_ops = {
541 .policy = ctrl_policy, 752 .policy = ctrl_policy,
542}; 753};
543 754
755static struct genl_multicast_group notify_grp = {
756 .name = "notify",
757};
758
544static int __init genl_init(void) 759static int __init genl_init(void)
545{ 760{
546 int i, err; 761 int i, err;
@@ -557,11 +772,17 @@ static int __init genl_init(void)
557 goto errout_register; 772 goto errout_register;
558 773
559 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV); 774 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV);
560 genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID, 775
561 genl_rcv, NULL, THIS_MODULE); 776 /* we'll bump the group number right afterwards */
777 genl_sock = netlink_kernel_create(NETLINK_GENERIC, 0, genl_rcv,
778 NULL, THIS_MODULE);
562 if (genl_sock == NULL) 779 if (genl_sock == NULL)
563 panic("GENL: Cannot initialize generic netlink\n"); 780 panic("GENL: Cannot initialize generic netlink\n");
564 781
782 err = genl_register_mc_group(&genl_ctrl, &notify_grp);
783 if (err < 0)
784 goto errout_register;
785
565 return 0; 786 return 0;
566 787
567errout_register: 788errout_register:
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c
index 5d66490dd29..dc9273295a3 100644
--- a/net/netrom/af_netrom.c
+++ b/net/netrom/af_netrom.c
@@ -720,7 +720,7 @@ static int nr_connect(struct socket *sock, struct sockaddr *uaddr,
720 720
721 for (;;) { 721 for (;;) {
722 prepare_to_wait(sk->sk_sleep, &wait, 722 prepare_to_wait(sk->sk_sleep, &wait,
723 TASK_INTERRUPTIBLE); 723 TASK_INTERRUPTIBLE);
724 if (sk->sk_state != TCP_SYN_SENT) 724 if (sk->sk_state != TCP_SYN_SENT)
725 break; 725 break;
726 if (!signal_pending(current)) { 726 if (!signal_pending(current)) {
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 7c27bd389b7..1322d62b5d9 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -108,7 +108,7 @@ Outgoing, dev->hard_header!=NULL
108Incoming, dev->hard_header==NULL 108Incoming, dev->hard_header==NULL
109 mac_header -> UNKNOWN position. It is very likely, that it points to ll 109 mac_header -> UNKNOWN position. It is very likely, that it points to ll
110 header. PPP makes it, that is wrong, because introduce 110 header. PPP makes it, that is wrong, because introduce
111 assymetry between rx and tx paths. 111 assymetry between rx and tx paths.
112 data -> data 112 data -> data
113 113
114Outgoing, dev->hard_header==NULL 114Outgoing, dev->hard_header==NULL
diff --git a/net/rfkill/rfkill-input.c b/net/rfkill/rfkill-input.c
index 230e35c5978..9f746be5885 100644
--- a/net/rfkill/rfkill-input.c
+++ b/net/rfkill/rfkill-input.c
@@ -83,7 +83,7 @@ static DEFINE_RFKILL_TASK(rfkill_wlan, RFKILL_TYPE_WLAN);
83static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH); 83static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH);
84 84
85static void rfkill_event(struct input_handle *handle, unsigned int type, 85static void rfkill_event(struct input_handle *handle, unsigned int type,
86 unsigned int code, int down) 86 unsigned int code, int down)
87{ 87{
88 if (type == EV_KEY && down == 1) { 88 if (type == EV_KEY && down == 1) {
89 switch (code) { 89 switch (code) {
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index f3986d498b4..db3395bfbcf 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -187,7 +187,7 @@ static ssize_t rfkill_claim_store(struct device *dev,
187static struct device_attribute rfkill_dev_attrs[] = { 187static struct device_attribute rfkill_dev_attrs[] = {
188 __ATTR(name, S_IRUGO, rfkill_name_show, NULL), 188 __ATTR(name, S_IRUGO, rfkill_name_show, NULL),
189 __ATTR(type, S_IRUGO, rfkill_type_show, NULL), 189 __ATTR(type, S_IRUGO, rfkill_type_show, NULL),
190 __ATTR(state, S_IRUGO, rfkill_state_show, rfkill_state_store), 190 __ATTR(state, S_IRUGO|S_IWUSR, rfkill_state_show, rfkill_state_store),
191 __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store), 191 __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store),
192 __ATTR_NULL 192 __ATTR_NULL
193}; 193};
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c
index f4d3aba0080..976c3cc86a2 100644
--- a/net/rose/af_rose.c
+++ b/net/rose/af_rose.c
@@ -816,7 +816,7 @@ rose_try_next_neigh:
816 816
817 for (;;) { 817 for (;;) {
818 prepare_to_wait(sk->sk_sleep, &wait, 818 prepare_to_wait(sk->sk_sleep, &wait,
819 TASK_INTERRUPTIBLE); 819 TASK_INTERRUPTIBLE);
820 if (sk->sk_state != TCP_SYN_SENT) 820 if (sk->sk_state != TCP_SYN_SENT)
821 break; 821 break;
822 if (!signal_pending(current)) { 822 if (!signal_pending(current)) {
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 2c57df9c131..46f6d572ad2 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -805,26 +805,26 @@ static int __init af_rxrpc_init(void)
805 } 805 }
806 806
807 ret = proto_register(&rxrpc_proto, 1); 807 ret = proto_register(&rxrpc_proto, 1);
808 if (ret < 0) { 808 if (ret < 0) {
809 printk(KERN_CRIT "RxRPC: Cannot register protocol\n"); 809 printk(KERN_CRIT "RxRPC: Cannot register protocol\n");
810 goto error_proto; 810 goto error_proto;
811 } 811 }
812 812
813 ret = sock_register(&rxrpc_family_ops); 813 ret = sock_register(&rxrpc_family_ops);
814 if (ret < 0) { 814 if (ret < 0) {
815 printk(KERN_CRIT "RxRPC: Cannot register socket family\n"); 815 printk(KERN_CRIT "RxRPC: Cannot register socket family\n");
816 goto error_sock; 816 goto error_sock;
817 } 817 }
818 818
819 ret = register_key_type(&key_type_rxrpc); 819 ret = register_key_type(&key_type_rxrpc);
820 if (ret < 0) { 820 if (ret < 0) {
821 printk(KERN_CRIT "RxRPC: Cannot register client key type\n"); 821 printk(KERN_CRIT "RxRPC: Cannot register client key type\n");
822 goto error_key_type; 822 goto error_key_type;
823 } 823 }
824 824
825 ret = register_key_type(&key_type_rxrpc_s); 825 ret = register_key_type(&key_type_rxrpc_s);
826 if (ret < 0) { 826 if (ret < 0) {
827 printk(KERN_CRIT "RxRPC: Cannot register server key type\n"); 827 printk(KERN_CRIT "RxRPC: Cannot register server key type\n");
828 goto error_key_type_s; 828 goto error_key_type_s;
829 } 829 }
830 830
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index f02ce3dddb7..fd2dfdd7d7f 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -1779,7 +1779,7 @@ static sctp_disposition_t sctp_sf_do_dupcook_d(const struct sctp_endpoint *ep,
1779 SCTP_COMM_UP, 0, 1779 SCTP_COMM_UP, 0,
1780 asoc->c.sinit_num_ostreams, 1780 asoc->c.sinit_num_ostreams,
1781 asoc->c.sinit_max_instreams, 1781 asoc->c.sinit_max_instreams,
1782 NULL, GFP_ATOMIC); 1782 NULL, GFP_ATOMIC);
1783 if (!ev) 1783 if (!ev)
1784 goto nomem; 1784 goto nomem;
1785 1785
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index b1917f68723..ee88f2ea510 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -4803,7 +4803,7 @@ static int sctp_getsockopt_partial_delivery_point(struct sock *sk, int len,
4803 char __user *optval, 4803 char __user *optval,
4804 int __user *optlen) 4804 int __user *optlen)
4805{ 4805{
4806 u32 val; 4806 u32 val;
4807 4807
4808 if (len < sizeof(u32)) 4808 if (len < sizeof(u32))
4809 return -EINVAL; 4809 return -EINVAL;
@@ -4827,7 +4827,7 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
4827 char __user *optval, 4827 char __user *optval,
4828 int __user *optlen) 4828 int __user *optlen)
4829{ 4829{
4830 int val; 4830 int val;
4831 4831
4832 if (len < sizeof(int)) 4832 if (len < sizeof(int))
4833 return -EINVAL; 4833 return -EINVAL;
diff --git a/net/sunrpc/auth_gss/gss_krb5_crypto.c b/net/sunrpc/auth_gss/gss_krb5_crypto.c
index f441aa0b26d..bfb6a29633d 100644
--- a/net/sunrpc/auth_gss/gss_krb5_crypto.c
+++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
@@ -67,7 +67,7 @@ krb5_encrypt(
67 67
68 if (crypto_blkcipher_ivsize(tfm) > 16) { 68 if (crypto_blkcipher_ivsize(tfm) > 16) {
69 dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n", 69 dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n",
70 crypto_blkcipher_ivsize(tfm)); 70 crypto_blkcipher_ivsize(tfm));
71 goto out; 71 goto out;
72 } 72 }
73 73
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 4a8f37f4876..84110172031 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1629,8 +1629,8 @@ static struct proto_ops msg_ops = {
1629 .getsockopt = getsockopt, 1629 .getsockopt = getsockopt,
1630 .sendmsg = send_msg, 1630 .sendmsg = send_msg,
1631 .recvmsg = recv_msg, 1631 .recvmsg = recv_msg,
1632 .mmap = sock_no_mmap, 1632 .mmap = sock_no_mmap,
1633 .sendpage = sock_no_sendpage 1633 .sendpage = sock_no_sendpage
1634}; 1634};
1635 1635
1636static struct proto_ops packet_ops = { 1636static struct proto_ops packet_ops = {
@@ -1650,8 +1650,8 @@ static struct proto_ops packet_ops = {
1650 .getsockopt = getsockopt, 1650 .getsockopt = getsockopt,
1651 .sendmsg = send_packet, 1651 .sendmsg = send_packet,
1652 .recvmsg = recv_msg, 1652 .recvmsg = recv_msg,
1653 .mmap = sock_no_mmap, 1653 .mmap = sock_no_mmap,
1654 .sendpage = sock_no_sendpage 1654 .sendpage = sock_no_sendpage
1655}; 1655};
1656 1656
1657static struct proto_ops stream_ops = { 1657static struct proto_ops stream_ops = {
@@ -1671,8 +1671,8 @@ static struct proto_ops stream_ops = {
1671 .getsockopt = getsockopt, 1671 .getsockopt = getsockopt,
1672 .sendmsg = send_stream, 1672 .sendmsg = send_stream,
1673 .recvmsg = recv_stream, 1673 .recvmsg = recv_stream,
1674 .mmap = sock_no_mmap, 1674 .mmap = sock_no_mmap,
1675 .sendpage = sock_no_sendpage 1675 .sendpage = sock_no_sendpage
1676}; 1676};
1677 1677
1678static struct net_proto_family tipc_family_ops = { 1678static struct net_proto_family tipc_family_ops = {
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index b48f06fc9fd..cfaf17c8851 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -857,7 +857,7 @@ xfrm_policy_flush_secctx_check(u8 type, struct xfrm_audit *audit_info)
857 pol, NULL); 857 pol, NULL);
858 return err; 858 return err;
859 } 859 }
860 } 860 }
861 for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) { 861 for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) {
862 hlist_for_each_entry(pol, entry, 862 hlist_for_each_entry(pol, entry,
863 xfrm_policy_bydst[dir].table + i, 863 xfrm_policy_bydst[dir].table + i,
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index e070c3f938f..38f90ca75b1 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -407,7 +407,7 @@ xfrm_state_flush_secctx_check(u8 proto, struct xfrm_audit *audit_info)
407 xfrm_audit_log(audit_info->loginuid, 407 xfrm_audit_log(audit_info->loginuid,
408 audit_info->secid, 408 audit_info->secid,
409 AUDIT_MAC_IPSEC_DELSA, 409 AUDIT_MAC_IPSEC_DELSA,
410 0, NULL, x); 410 0, NULL, x);
411 411
412 return err; 412 return err;
413 } 413 }