Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (25 commits)
[TG3]: Fix msi issue with kexec/kdump.
[NET] XFRM: Fix whitespace errors.
[NET] TIPC: Fix whitespace errors.
[NET] SUNRPC: Fix whitespace errors.
[NET] SCTP: Fix whitespace errors.
[NET] RXRPC: Fix whitespace errors.
[NET] ROSE: Fix whitespace errors.
[NET] RFKILL: Fix whitespace errors.
[NET] PACKET: Fix whitespace errors.
[NET] NETROM: Fix whitespace errors.
[NET] NETFILTER: Fix whitespace errors.
[NET] IPV4: Fix whitespace errors.
[NET] DCCP: Fix whitespace errors.
[NET] CORE: Fix whitespace errors.
[NET] BLUETOOTH: Fix whitespace errors.
[NET] AX25: Fix whitespace errors.
[PATCH] mac80211: remove rtnl locking in ieee80211_sta.c
[PATCH] mac80211: fix GCC warning on 64bit platforms
[GENETLINK]: Dynamic multicast groups.
[NETLIKN]: Allow removing multicast groups.
...

+663 -270
+65 -49
drivers/net/tg3.c
··· 64 64 65 65 #define DRV_MODULE_NAME "tg3" 66 66 #define PFX DRV_MODULE_NAME ": " 67 - #define DRV_MODULE_VERSION "3.78" 68 - #define DRV_MODULE_RELDATE "July 11, 2007" 67 + #define DRV_MODULE_VERSION "3.79" 68 + #define DRV_MODULE_RELDATE "July 18, 2007" 69 69 70 70 #define TG3_DEF_MAC_MODE 0 71 71 #define TG3_DEF_RX_MODE 0 ··· 4847 4847 return 0; 4848 4848 } 4849 4849 4850 + /* Save PCI command register before chip reset */ 4851 + static 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 */ 4860 + static 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 + 4850 4903 static void tg3_stop_fw(struct tg3 *); 4851 4904 4852 4905 /* tp->lock is held. */ ··· 4915 4862 * chip reset below will undo the nvram lock. 4916 4863 */ 4917 4864 tp->nvram_lock_cnt = 0; 4865 + 4866 + /* GRC_MISC_CFG core clock reset will clear the memory 4867 + * enable bit in PCI register 4 and the MSI enable bit 4868 + * on some chips, so we save relevant registers here. 4869 + */ 4870 + tg3_save_pci_state(tp); 4918 4871 4919 4872 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5752 || 4920 4873 GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5755 || ··· 5020 4961 pci_write_config_dword(tp->pdev, 0xd8, 0xf5000); 5021 4962 } 5022 4963 5023 - /* Re-enable indirect register accesses. */ 5024 - pci_write_config_dword(tp->pdev, TG3PCI_MISC_HOST_CTRL, 5025 - tp->misc_host_ctrl); 5026 - 5027 - /* Set MAX PCI retry to zero. */ 5028 - val = (PCISTATE_ROM_ENABLE | PCISTATE_ROM_RETRY_ENABLE); 5029 - if (tp->pci_chip_rev_id == CHIPREV_ID_5704_A0 && 5030 - (tp->tg3_flags & TG3_FLAG_PCIX_MODE)) 5031 - val |= PCISTATE_RETRY_SAME_DMA; 5032 - pci_write_config_dword(tp->pdev, TG3PCI_PCISTATE, val); 5033 - 5034 - pci_restore_state(tp->pdev); 4964 + tg3_restore_pci_state(tp); 5035 4965 5036 4966 tp->tg3_flags &= ~TG3_FLAG_CHIP_RESETTING; 5037 4967 5038 - /* Make sure PCI-X relaxed ordering bit is clear. */ 5039 - pci_read_config_dword(tp->pdev, TG3PCI_X_CAPS, &val); 5040 - val &= ~PCIX_CAPS_RELAXED_ORDERING; 5041 - pci_write_config_dword(tp->pdev, TG3PCI_X_CAPS, val); 5042 - 5043 - if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) { 5044 - u32 val; 5045 - 5046 - /* Chip reset on 5780 will reset MSI enable bit, 5047 - * so need to restore it. 5048 - */ 5049 - if (tp->tg3_flags2 & TG3_FLG2_USING_MSI) { 5050 - u16 ctrl; 5051 - 5052 - pci_read_config_word(tp->pdev, 5053 - tp->msi_cap + PCI_MSI_FLAGS, 5054 - &ctrl); 5055 - pci_write_config_word(tp->pdev, 5056 - tp->msi_cap + PCI_MSI_FLAGS, 5057 - ctrl | PCI_MSI_FLAGS_ENABLE); 5058 - val = tr32(MSGINT_MODE); 5059 - tw32(MSGINT_MODE, val | MSGINT_MODE_ENABLE); 5060 - } 5061 - 4968 + val = 0; 4969 + if (tp->tg3_flags2 & TG3_FLG2_5780_CLASS) 5062 4970 val = tr32(MEMARB_MODE); 5063 - tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); 5064 - 5065 - } else 5066 - tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 4971 + tw32(MEMARB_MODE, val | MEMARB_MODE_ENABLE); 5067 4972 5068 4973 if (tp->pci_chip_rev_id == CHIPREV_ID_5750_A3) { 5069 4974 tg3_stop_fw(tp); ··· 12001 11978 */ 12002 11979 if ((tr32(HOSTCC_MODE) & HOSTCC_MODE_ENABLE) || 12003 11980 (tr32(WDMAC_MODE) & WDMAC_MODE_ENABLE)) { 12004 - pci_save_state(tp->pdev); 12005 11981 tw32(MEMARB_MODE, MEMARB_MODE_ENABLE); 12006 11982 tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); 12007 11983 } ··· 12028 12006 tp->tg3_flags |= TG3_FLAG_PAUSE_AUTONEG; 12029 12007 12030 12008 tg3_init_coal(tp); 12031 - 12032 - /* Now that we have fully setup the chip, save away a snapshot 12033 - * of the PCI config space. We need to restore this after 12034 - * GRC_MISC_CFG core clock resets and some resume events. 12035 - */ 12036 - pci_save_state(tp->pdev); 12037 12009 12038 12010 pci_set_drvdata(pdev, dev); 12039 12011
+1
drivers/net/tg3.h
··· 2345 2345 #define PHY_REV_BCM5411_X0 0x1 /* Found on Netgear GA302T */ 2346 2346 2347 2347 u32 led_ctrl; 2348 + u32 pci_cmd; 2348 2349 2349 2350 char board_part_number[24]; 2350 2351 char fw_ver[16];
+13
include/linux/genetlink.h
··· 39 39 CTRL_CMD_NEWOPS, 40 40 CTRL_CMD_DELOPS, 41 41 CTRL_CMD_GETOPS, 42 + CTRL_CMD_NEWMCAST_GRP, 43 + CTRL_CMD_DELMCAST_GRP, 44 + CTRL_CMD_GETMCAST_GRP, /* unused */ 42 45 __CTRL_CMD_MAX, 43 46 }; 44 47 ··· 55 52 CTRL_ATTR_HDRSIZE, 56 53 CTRL_ATTR_MAXATTR, 57 54 CTRL_ATTR_OPS, 55 + CTRL_ATTR_MCAST_GROUPS, 58 56 __CTRL_ATTR_MAX, 59 57 }; 60 58 ··· 69 65 }; 70 66 71 67 #define CTRL_ATTR_OP_MAX (__CTRL_ATTR_OP_MAX - 1) 68 + 69 + enum { 70 + CTRL_ATTR_MCAST_GRP_UNSPEC, 71 + CTRL_ATTR_MCAST_GRP_NAME, 72 + CTRL_ATTR_MCAST_GRP_ID, 73 + __CTRL_ATTR_MCAST_GRP_MAX, 74 + }; 75 + 76 + #define CTRL_ATTR_MCAST_GRP_MAX (__CTRL_ATTR_MCAST_GRP_MAX - 1) 72 77 73 78 #endif /* __LINUX_GENERIC_NETLINK_H */
+2
include/linux/netlink.h
··· 161 161 void (*input)(struct sock *sk, int len), 162 162 struct mutex *cb_mutex, 163 163 struct module *module); 164 + extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); 165 + extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); 164 166 extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); 165 167 extern int netlink_has_listeners(struct sock *sk, unsigned int group); 166 168 extern int netlink_unicast(struct sock *ssk, struct sk_buff *skb, __u32 pid, int nonblock);
+22
include/net/genetlink.h
··· 5 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 + */ 15 + struct 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 24 * struct genl_family - generic netlink family 9 25 * @id: protocol family idenfitier 10 26 * @hdrsize: length of user specific header in bytes ··· 30 14 * @attrbuf: buffer to store parsed attributes 31 15 * @ops_list: list of all assigned operations 32 16 * @family_list: family list 17 + * @mcast_groups: multicast groups list 33 18 */ 34 19 struct genl_family 35 20 { ··· 42 25 struct nlattr ** attrbuf; /* private */ 43 26 struct list_head ops_list; /* private */ 44 27 struct list_head family_list; /* private */ 28 + struct list_head mcast_groups; /* private */ 45 29 }; 46 30 47 31 /** ··· 91 73 extern int genl_unregister_family(struct genl_family *family); 92 74 extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 93 75 extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 76 + extern int genl_register_mc_group(struct genl_family *family, 77 + struct genl_multicast_group *grp); 78 + extern void genl_unregister_mc_group(struct genl_family *family, 79 + struct genl_multicast_group *grp); 94 80 95 81 extern struct sock *genl_sock; 96 82
+1 -1
net/ax25/af_ax25.c
··· 1262 1262 1263 1263 for (;;) { 1264 1264 prepare_to_wait(sk->sk_sleep, &wait, 1265 - TASK_INTERRUPTIBLE); 1265 + TASK_INTERRUPTIBLE); 1266 1266 if (sk->sk_state != TCP_SYN_SENT) 1267 1267 break; 1268 1268 if (!signal_pending(current)) {
+1 -1
net/bluetooth/hci_core.c
··· 982 982 983 983 skb->dev = (void *) hdev; 984 984 bt_cb(skb)->pkt_type = type; 985 - 985 + 986 986 __reassembly(hdev, type) = skb; 987 987 988 988 scb = (void *) skb->cb;
+1 -1
net/core/dev.c
··· 2629 2629 return; 2630 2630 2631 2631 if (!netif_device_present(dev)) 2632 - return; 2632 + return; 2633 2633 2634 2634 if (dev->set_rx_mode) 2635 2635 dev->set_rx_mode(dev);
+1 -1
net/core/rtnetlink.c
··· 98 98 } 99 99 100 100 int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr, 101 - struct rtattr *rta, int len) 101 + struct rtattr *rta, int len) 102 102 { 103 103 if (RTA_PAYLOAD(rta) < len) 104 104 return -1;
+1 -1
net/core/sock.c
··· 230 230 warned++; 231 231 printk(KERN_INFO "sock_set_timeout: `%s' (pid %d) " 232 232 "tries to set negative timeout\n", 233 - current->comm, current->pid); 233 + current->comm, current->pid); 234 234 return 0; 235 235 } 236 236 *timeo_p = MAX_SCHEDULE_TIMEOUT;
+1 -1
net/dccp/ccids/lib/loss_interval.c
··· 227 227 struct list_head *li_hist_list, 228 228 struct list_head *hist_list, 229 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 232 struct dccp_li_hist_entry *head; 233 233 u64 seq_temp;
+1 -1
net/ipv4/fib_frontend.c
··· 817 817 static void nl_fib_lookup_init(void) 818 818 { 819 819 netlink_kernel_create(NETLINK_FIB_LOOKUP, 0, nl_fib_input, NULL, 820 - THIS_MODULE); 820 + THIS_MODULE); 821 821 } 822 822 823 823 static void fib_disable_ip(struct net_device *dev, int force)
+1 -1
net/ipv4/ip_forward.c
··· 86 86 goto sr_failed; 87 87 88 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 90 IP_INC_STATS(IPSTATS_MIB_FRAGFAILS); 91 91 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, 92 92 htonl(dst_mtu(&rt->u.dst)));
+1 -1
net/ipv4/tcp_output.c
··· 1615 1615 if (window <= free_space - mss || window > free_space) 1616 1616 window = (free_space/mss)*mss; 1617 1617 else if (mss == full_space && 1618 - free_space > window + full_space/2) 1618 + free_space > window + full_space/2) 1619 1619 window = free_space; 1620 1620 } 1621 1621
+1
net/mac80211/Makefile
··· 13 13 ieee80211_iface.o \ 14 14 ieee80211_rate.o \ 15 15 michael.o \ 16 + regdomain.o \ 16 17 tkip.o \ 17 18 aes_ccm.o \ 18 19 wme.o \
+6 -3
net/mac80211/debugfs_netdev.c
··· 397 397 void *ndev) 398 398 { 399 399 struct net_device *dev = ndev; 400 + struct dentry *dir; 401 + struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 400 402 char buf[10+IFNAMSIZ]; 401 403 402 404 if (state != NETDEV_CHANGENAME) ··· 410 408 if (dev->ieee80211_ptr->wiphy->privid != mac80211_wiphy_privid) 411 409 return 0; 412 410 413 - /* TODO 414 411 sprintf(buf, "netdev:%s", dev->name); 415 - debugfs_rename(IEEE80211_DEV_TO_SUB_IF(dev)->debugfsdir, buf); 416 - */ 412 + dir = sdata->debugfsdir; 413 + if (!debugfs_rename(dir->d_parent, dir, dir->d_parent, buf)) 414 + printk(KERN_ERR "mac80211: debugfs: failed to rename debugfs " 415 + "dir to %s\n", buf); 417 416 418 417 return 0; 419 418 }
+4 -3
net/mac80211/ieee80211.c
··· 4986 4986 * and we need some headroom for passing the frame to monitor 4987 4987 * interfaces, but never both at the same time. 4988 4988 */ 4989 - local->tx_headroom = max(local->hw.extra_tx_headroom, 4990 - sizeof(struct ieee80211_tx_status_rtap_hdr)); 4989 + local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, 4990 + sizeof(struct ieee80211_tx_status_rtap_hdr)); 4991 4991 4992 4992 debugfs_hw_add(local); 4993 4993 ··· 5095 5095 } 5096 5096 5097 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 5100 return 0; 5101 5101 } ··· 5246 5246 } 5247 5247 5248 5248 ieee80211_debugfs_netdev_init(); 5249 + ieee80211_regdomain_init(); 5249 5250 5250 5251 return 0; 5251 5252 }
+4 -1
net/mac80211/ieee80211_i.h
··· 759 759 /* ieee80211_ioctl.c */ 760 760 int ieee80211_set_compression(struct ieee80211_local *local, 761 761 struct net_device *dev, struct sta_info *sta); 762 - int ieee80211_init_client(struct net_device *dev); 763 762 int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq); 764 763 /* ieee80211_sta.c */ 765 764 void ieee80211_sta_timer(unsigned long data); ··· 796 797 void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); 797 798 int ieee80211_if_add_mgmt(struct ieee80211_local *local); 798 799 void ieee80211_if_del_mgmt(struct ieee80211_local *local); 800 + 801 + /* regdomain.c */ 802 + void ieee80211_regdomain_init(void); 803 + void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode); 799 804 800 805 /* for wiphy privid */ 801 806 extern void *mac80211_wiphy_privid;
-133
net/mac80211/ieee80211_ioctl.c
··· 27 27 #include "aes_ccm.h" 28 28 #include "debugfs_key.h" 29 29 30 - static int ieee80211_regdom = 0x10; /* FCC */ 31 - module_param(ieee80211_regdom, int, 0444); 32 - MODULE_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 - */ 40 - static int ieee80211_japan_5ghz /* = 0 */; 41 - module_param(ieee80211_japan_5ghz, int, 0444); 42 - MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz"); 43 - 44 30 static void ieee80211_set_hw_encryption(struct net_device *dev, 45 31 struct sta_info *sta, u8 addr[ETH_ALEN], 46 32 struct ieee80211_key *key) ··· 394 408 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); 395 409 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); 396 410 397 - return 0; 398 - } 399 - 400 - 401 - struct ieee80211_channel_range { 402 - short start_freq; 403 - short end_freq; 404 - unsigned char power_level; 405 - unsigned char antenna_max; 406 - }; 407 - 408 - static const struct ieee80211_channel_range ieee80211_fcc_channels[] = { 409 - { 2412, 2462, 27, 6 } /* IEEE 802.11b/g, channels 1..11 */, 410 - { 5180, 5240, 17, 6 } /* IEEE 802.11a, channels 36..48 */, 411 - { 5260, 5320, 23, 6 } /* IEEE 802.11a, channels 52..64 */, 412 - { 5745, 5825, 30, 6 } /* IEEE 802.11a, channels 149..165, outdoor */, 413 - { 0 } 414 - }; 415 - 416 - static const struct ieee80211_channel_range ieee80211_mkk_channels[] = { 417 - { 2412, 2472, 20, 6 } /* IEEE 802.11b/g, channels 1..13 */, 418 - { 5170, 5240, 20, 6 } /* IEEE 802.11a, channels 34..48 */, 419 - { 5260, 5320, 20, 6 } /* IEEE 802.11a, channels 52..64 */, 420 - { 0 } 421 - }; 422 - 423 - 424 - static const struct ieee80211_channel_range *channel_range = 425 - ieee80211_fcc_channels; 426 - 427 - 428 - static void ieee80211_unmask_channel(struct net_device *dev, int mode, 429 - struct ieee80211_channel *chan) 430 - { 431 - int i; 432 - 433 - chan->flag = 0; 434 - 435 - if (ieee80211_regdom == 64 && 436 - (mode == MODE_ATHEROS_TURBO || mode == MODE_ATHEROS_TURBOG)) { 437 - /* Do not allow Turbo modes in Japan. */ 438 - return; 439 - } 440 - 441 - for (i = 0; channel_range[i].start_freq; i++) { 442 - const struct ieee80211_channel_range *r = &channel_range[i]; 443 - if (r->start_freq <= chan->freq && r->end_freq >= chan->freq) { 444 - if (ieee80211_regdom == 64 && !ieee80211_japan_5ghz && 445 - chan->freq >= 5260 && chan->freq <= 5320) { 446 - /* 447 - * Skip new channels in Japan since the 448 - * firmware was not marked having been upgraded 449 - * by the vendor. 450 - */ 451 - continue; 452 - } 453 - 454 - if (ieee80211_regdom == 0x10 && 455 - (chan->freq == 5190 || chan->freq == 5210 || 456 - chan->freq == 5230)) { 457 - /* Skip MKK channels when in FCC domain. */ 458 - continue; 459 - } 460 - 461 - chan->flag |= IEEE80211_CHAN_W_SCAN | 462 - IEEE80211_CHAN_W_ACTIVE_SCAN | 463 - IEEE80211_CHAN_W_IBSS; 464 - chan->power_level = r->power_level; 465 - chan->antenna_max = r->antenna_max; 466 - 467 - if (ieee80211_regdom == 64 && 468 - (chan->freq == 5170 || chan->freq == 5190 || 469 - chan->freq == 5210 || chan->freq == 5230)) { 470 - /* 471 - * New regulatory rules in Japan have backwards 472 - * compatibility with old channels in 5.15-5.25 473 - * GHz band, but the station is not allowed to 474 - * use active scan on these old channels. 475 - */ 476 - chan->flag &= ~IEEE80211_CHAN_W_ACTIVE_SCAN; 477 - } 478 - 479 - if (ieee80211_regdom == 64 && 480 - (chan->freq == 5260 || chan->freq == 5280 || 481 - chan->freq == 5300 || chan->freq == 5320)) { 482 - /* 483 - * IBSS is not allowed on 5.25-5.35 GHz band 484 - * due to radar detection requirements. 485 - */ 486 - chan->flag &= ~IEEE80211_CHAN_W_IBSS; 487 - } 488 - 489 - break; 490 - } 491 - } 492 - } 493 - 494 - 495 - static int ieee80211_unmask_channels(struct net_device *dev) 496 - { 497 - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 498 - struct ieee80211_hw_mode *mode; 499 - int c; 500 - 501 - list_for_each_entry(mode, &local->modes_list, list) { 502 - for (c = 0; c < mode->num_channels; c++) { 503 - ieee80211_unmask_channel(dev, mode->mode, 504 - &mode->channels[c]); 505 - } 506 - } 507 - return 0; 508 - } 509 - 510 - 511 - int ieee80211_init_client(struct net_device *dev) 512 - { 513 - if (ieee80211_regdom == 0x40) 514 - channel_range = ieee80211_mkk_channels; 515 - ieee80211_unmask_channels(dev); 516 411 return 0; 517 412 } 518 413
-6
net/mac80211/ieee80211_sta.c
··· 25 25 #include <linux/wireless.h> 26 26 #include <linux/random.h> 27 27 #include <linux/etherdevice.h> 28 - #include <linux/rtnetlink.h> 29 28 #include <net/iw_handler.h> 30 29 #include <asm/types.h> 31 30 ··· 2105 2106 struct ieee80211_sta_bss *bss, *selected = NULL; 2106 2107 int top_rssi = 0, freq; 2107 2108 2108 - rtnl_lock(); 2109 - 2110 2109 if (!ifsta->auto_channel_sel && !ifsta->auto_bssid_sel && 2111 2110 !ifsta->auto_ssid_sel) { 2112 2111 ifsta->state = IEEE80211_AUTHENTICATE; 2113 - rtnl_unlock(); 2114 2112 ieee80211_sta_reset_auth(dev, ifsta); 2115 2113 return 0; 2116 2114 } ··· 2150 2154 ieee80211_sta_set_bssid(dev, selected->bssid); 2151 2155 ieee80211_rx_bss_put(dev, selected); 2152 2156 ifsta->state = IEEE80211_AUTHENTICATE; 2153 - rtnl_unlock(); 2154 2157 ieee80211_sta_reset_auth(dev, ifsta); 2155 2158 return 0; 2156 2159 } else { ··· 2160 2165 } else 2161 2166 ifsta->state = IEEE80211_DISABLED; 2162 2167 } 2163 - rtnl_unlock(); 2164 2168 return -1; 2165 2169 } 2166 2170
+158
net/mac80211/regdomain.c
··· 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 + 37 + static int ieee80211_regdom = 0x10; /* FCC */ 38 + module_param(ieee80211_regdom, int, 0444); 39 + MODULE_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 + */ 47 + static int ieee80211_japan_5ghz /* = 0 */; 48 + module_param(ieee80211_japan_5ghz, int, 0444); 49 + MODULE_PARM_DESC(ieee80211_japan_5ghz, "Vendor-updated firmware for 5 GHz"); 50 + 51 + 52 + struct ieee80211_channel_range { 53 + short start_freq; 54 + short end_freq; 55 + unsigned char power_level; 56 + unsigned char antenna_max; 57 + }; 58 + 59 + static 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 + 67 + static 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 + 75 + static const struct ieee80211_channel_range *channel_range = 76 + ieee80211_fcc_channels; 77 + 78 + 79 + static 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 + 145 + void 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 + 153 + void ieee80211_regdomain_init(void) 154 + { 155 + if (ieee80211_regdom == 0x40) 156 + channel_range = ieee80211_mkk_channels; 157 + } 158 +
+1 -1
net/netfilter/nf_conntrack_standalone.c
··· 181 181 182 182 if (seq_printf(s, "use=%u\n", atomic_read(&conntrack->ct_general.use))) 183 183 return -ENOSPC; 184 - 184 + 185 185 return 0; 186 186 } 187 187
+1 -1
net/netfilter/nf_log.c
··· 9 9 10 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 13 LOG target modules */ 14 14 15 15 #define NF_LOG_PREFIXLEN 128
+126 -35
net/netlink/af_netlink.c
··· 62 62 #include <net/netlink.h> 63 63 64 64 #define NLGRPSZ(x) (ALIGN(x, sizeof(unsigned long) * 8) / 8) 65 + #define NLGRPLONGS(x) (NLGRPSZ(x)/sizeof(unsigned long)) 65 66 66 67 struct netlink_sock { 67 68 /* struct sock has to be the first member of netlink_sock */ ··· 315 314 unsigned long mask; 316 315 unsigned int i; 317 316 318 - for (i = 0; i < NLGRPSZ(tbl->groups)/sizeof(unsigned long); i++) { 317 + for (i = 0; i < NLGRPLONGS(tbl->groups); i++) { 319 318 mask = 0; 320 - sk_for_each_bound(sk, node, &tbl->mc_list) 321 - mask |= nlk_sk(sk)->groups[i]; 319 + sk_for_each_bound(sk, node, &tbl->mc_list) { 320 + if (i < NLGRPLONGS(nlk_sk(sk)->ngroups)) 321 + mask |= nlk_sk(sk)->groups[i]; 322 + } 322 323 tbl->listeners[i] = mask; 323 324 } 324 325 /* this function is only called with the netlink table "grabbed", which ··· 558 555 nlk->subscriptions = subscriptions; 559 556 } 560 557 561 - static int netlink_alloc_groups(struct sock *sk) 558 + static int netlink_realloc_groups(struct sock *sk) 562 559 { 563 560 struct netlink_sock *nlk = nlk_sk(sk); 564 561 unsigned int groups; 562 + unsigned long *new_groups; 565 563 int err = 0; 566 564 567 - netlink_lock_table(); 565 + netlink_table_grab(); 566 + 568 567 groups = nl_table[sk->sk_protocol].groups; 569 - if (!nl_table[sk->sk_protocol].registered) 568 + if (!nl_table[sk->sk_protocol].registered) { 570 569 err = -ENOENT; 571 - netlink_unlock_table(); 570 + goto out_unlock; 571 + } 572 572 573 - if (err) 574 - return err; 573 + if (nlk->ngroups >= groups) 574 + goto out_unlock; 575 575 576 - nlk->groups = kzalloc(NLGRPSZ(groups), GFP_KERNEL); 577 - if (nlk->groups == NULL) 578 - return -ENOMEM; 576 + new_groups = krealloc(nlk->groups, NLGRPSZ(groups), GFP_ATOMIC); 577 + if (new_groups == NULL) { 578 + err = -ENOMEM; 579 + goto out_unlock; 580 + } 581 + memset((char*)new_groups + NLGRPSZ(nlk->ngroups), 0, 582 + NLGRPSZ(groups) - NLGRPSZ(nlk->ngroups)); 583 + 584 + nlk->groups = new_groups; 579 585 nlk->ngroups = groups; 580 - return 0; 586 + out_unlock: 587 + netlink_table_ungrab(); 588 + return err; 581 589 } 582 590 583 591 static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len) ··· 605 591 if (nladdr->nl_groups) { 606 592 if (!netlink_capable(sock, NL_NONROOT_RECV)) 607 593 return -EPERM; 608 - if (nlk->groups == NULL) { 609 - err = netlink_alloc_groups(sk); 610 - if (err) 611 - return err; 612 - } 594 + err = netlink_realloc_groups(sk); 595 + if (err) 596 + return err; 613 597 } 614 598 615 599 if (nlk->pid) { ··· 851 839 int netlink_has_listeners(struct sock *sk, unsigned int group) 852 840 { 853 841 int res = 0; 842 + unsigned long *listeners; 854 843 855 844 BUG_ON(!(nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET)); 845 + 846 + rcu_read_lock(); 847 + listeners = rcu_dereference(nl_table[sk->sk_protocol].listeners); 848 + 856 849 if (group - 1 < nl_table[sk->sk_protocol].groups) 857 - res = test_bit(group - 1, nl_table[sk->sk_protocol].listeners); 850 + res = test_bit(group - 1, listeners); 851 + 852 + rcu_read_unlock(); 853 + 858 854 return res; 859 855 } 860 856 EXPORT_SYMBOL_GPL(netlink_has_listeners); ··· 1027 1007 read_unlock(&nl_table_lock); 1028 1008 } 1029 1009 1010 + /* must be called with netlink table grabbed */ 1011 + static void netlink_update_socket_mc(struct netlink_sock *nlk, 1012 + unsigned int group, 1013 + int is_new) 1014 + { 1015 + int old, new = !!is_new, subscriptions; 1016 + 1017 + old = test_bit(group - 1, nlk->groups); 1018 + subscriptions = nlk->subscriptions - old + new; 1019 + if (new) 1020 + __set_bit(group - 1, nlk->groups); 1021 + else 1022 + __clear_bit(group - 1, nlk->groups); 1023 + netlink_update_subscriptions(&nlk->sk, subscriptions); 1024 + netlink_update_listeners(&nlk->sk); 1025 + } 1026 + 1030 1027 static int netlink_setsockopt(struct socket *sock, int level, int optname, 1031 1028 char __user *optval, int optlen) 1032 1029 { ··· 1069 1032 break; 1070 1033 case NETLINK_ADD_MEMBERSHIP: 1071 1034 case NETLINK_DROP_MEMBERSHIP: { 1072 - unsigned int subscriptions; 1073 - int old, new = optname == NETLINK_ADD_MEMBERSHIP ? 1 : 0; 1074 - 1075 1035 if (!netlink_capable(sock, NL_NONROOT_RECV)) 1076 1036 return -EPERM; 1077 - if (nlk->groups == NULL) { 1078 - err = netlink_alloc_groups(sk); 1079 - if (err) 1080 - return err; 1081 - } 1037 + err = netlink_realloc_groups(sk); 1038 + if (err) 1039 + return err; 1082 1040 if (!val || val - 1 >= nlk->ngroups) 1083 1041 return -EINVAL; 1084 1042 netlink_table_grab(); 1085 - old = test_bit(val - 1, nlk->groups); 1086 - subscriptions = nlk->subscriptions - old + new; 1087 - if (new) 1088 - __set_bit(val - 1, nlk->groups); 1089 - else 1090 - __clear_bit(val - 1, nlk->groups); 1091 - netlink_update_subscriptions(sk, subscriptions); 1092 - netlink_update_listeners(sk); 1043 + netlink_update_socket_mc(nlk, val, 1044 + optname == NETLINK_ADD_MEMBERSHIP); 1093 1045 netlink_table_ungrab(); 1094 1046 err = 0; 1095 1047 break; ··· 1353 1327 sock_release(sock); 1354 1328 return NULL; 1355 1329 } 1330 + 1331 + /** 1332 + * netlink_change_ngroups - change number of multicast groups 1333 + * 1334 + * This changes the number of multicast groups that are available 1335 + * on a certain netlink family. Note that it is not possible to 1336 + * change the number of groups to below 32. Also note that it does 1337 + * not implicitly call netlink_clear_multicast_users() when the 1338 + * number of groups is reduced. 1339 + * 1340 + * @sk: The kernel netlink socket, as returned by netlink_kernel_create(). 1341 + * @groups: The new number of groups. 1342 + */ 1343 + int netlink_change_ngroups(struct sock *sk, unsigned int groups) 1344 + { 1345 + unsigned long *listeners, *old = NULL; 1346 + struct netlink_table *tbl = &nl_table[sk->sk_protocol]; 1347 + int err = 0; 1348 + 1349 + if (groups < 32) 1350 + groups = 32; 1351 + 1352 + netlink_table_grab(); 1353 + if (NLGRPSZ(tbl->groups) < NLGRPSZ(groups)) { 1354 + listeners = kzalloc(NLGRPSZ(groups), GFP_ATOMIC); 1355 + if (!listeners) { 1356 + err = -ENOMEM; 1357 + goto out_ungrab; 1358 + } 1359 + old = tbl->listeners; 1360 + memcpy(listeners, old, NLGRPSZ(tbl->groups)); 1361 + rcu_assign_pointer(tbl->listeners, listeners); 1362 + } 1363 + tbl->groups = groups; 1364 + 1365 + out_ungrab: 1366 + netlink_table_ungrab(); 1367 + synchronize_rcu(); 1368 + kfree(old); 1369 + return err; 1370 + } 1371 + EXPORT_SYMBOL(netlink_change_ngroups); 1372 + 1373 + /** 1374 + * netlink_clear_multicast_users - kick off multicast listeners 1375 + * 1376 + * This function removes all listeners from the given group. 1377 + * @ksk: The kernel netlink socket, as returned by 1378 + * netlink_kernel_create(). 1379 + * @group: The multicast group to clear. 1380 + */ 1381 + void netlink_clear_multicast_users(struct sock *ksk, unsigned int group) 1382 + { 1383 + struct sock *sk; 1384 + struct hlist_node *node; 1385 + struct netlink_table *tbl = &nl_table[ksk->sk_protocol]; 1386 + 1387 + netlink_table_grab(); 1388 + 1389 + sk_for_each_bound(sk, node, &tbl->mc_list) 1390 + netlink_update_socket_mc(nlk_sk(sk), group, 0); 1391 + 1392 + netlink_table_ungrab(); 1393 + } 1394 + EXPORT_SYMBOL(netlink_clear_multicast_users); 1356 1395 1357 1396 void netlink_set_nonroot(int protocol, unsigned int flags) 1358 1397 {
+228 -7
net/netlink/genetlink.c
··· 3 3 * 4 4 * Authors: Jamal Hadi Salim 5 5 * Thomas Graf <tgraf@suug.ch> 6 + * Johannes Berg <johannes@sipsolutions.net> 6 7 */ 7 8 8 9 #include <linux/module.h> ··· 14 13 #include <linux/string.h> 15 14 #include <linux/skbuff.h> 16 15 #include <linux/mutex.h> 16 + #include <linux/bitmap.h> 17 17 #include <net/sock.h> 18 18 #include <net/genetlink.h> 19 19 ··· 44 42 #define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1) 45 43 46 44 static struct list_head family_ht[GENL_FAM_TAB_SIZE]; 45 + /* 46 + * Bitmap of multicast groups that are currently in use. 47 + * 48 + * To avoid an allocation at boot of just one unsigned long, 49 + * declare it global instead. 50 + * Bit 0 is marked as already used since group 0 is invalid. 51 + */ 52 + static unsigned long mc_group_start = 0x1; 53 + static unsigned long *mc_groups = &mc_group_start; 54 + static unsigned long mc_groups_longs = 1; 47 55 48 56 static int genl_ctrl_event(int event, void *data); 49 57 ··· 126 114 } while (genl_family_find_byid(id_gen_idx)); 127 115 128 116 return id_gen_idx; 117 + } 118 + 119 + static struct genl_multicast_group notify_grp; 120 + 121 + /** 122 + * genl_register_mc_group - register a multicast group 123 + * 124 + * Registers the specified multicast group and notifies userspace 125 + * about the new group. 126 + * 127 + * Returns 0 on success or a negative error code. 128 + * 129 + * @family: The generic netlink family the group shall be registered for. 130 + * @grp: The group to register, must have a name. 131 + */ 132 + int genl_register_mc_group(struct genl_family *family, 133 + struct genl_multicast_group *grp) 134 + { 135 + int id; 136 + unsigned long *new_groups; 137 + int err; 138 + 139 + BUG_ON(grp->name[0] == '\0'); 140 + 141 + genl_lock(); 142 + 143 + /* special-case our own group */ 144 + if (grp == &notify_grp) 145 + id = GENL_ID_CTRL; 146 + else 147 + id = find_first_zero_bit(mc_groups, 148 + mc_groups_longs * BITS_PER_LONG); 149 + 150 + 151 + if (id >= mc_groups_longs * BITS_PER_LONG) { 152 + size_t nlen = (mc_groups_longs + 1) * sizeof(unsigned long); 153 + 154 + if (mc_groups == &mc_group_start) { 155 + new_groups = kzalloc(nlen, GFP_KERNEL); 156 + if (!new_groups) { 157 + err = -ENOMEM; 158 + goto out; 159 + } 160 + mc_groups = new_groups; 161 + *mc_groups = mc_group_start; 162 + } else { 163 + new_groups = krealloc(mc_groups, nlen, GFP_KERNEL); 164 + if (!new_groups) { 165 + err = -ENOMEM; 166 + goto out; 167 + } 168 + mc_groups = new_groups; 169 + mc_groups[mc_groups_longs] = 0; 170 + } 171 + mc_groups_longs++; 172 + } 173 + 174 + err = netlink_change_ngroups(genl_sock, 175 + sizeof(unsigned long) * NETLINK_GENERIC); 176 + if (err) 177 + goto out; 178 + 179 + grp->id = id; 180 + set_bit(id, mc_groups); 181 + list_add_tail(&grp->list, &family->mcast_groups); 182 + grp->family = family; 183 + 184 + genl_ctrl_event(CTRL_CMD_NEWMCAST_GRP, grp); 185 + out: 186 + genl_unlock(); 187 + return 0; 188 + } 189 + EXPORT_SYMBOL(genl_register_mc_group); 190 + 191 + /** 192 + * genl_unregister_mc_group - unregister a multicast group 193 + * 194 + * Unregisters the specified multicast group and notifies userspace 195 + * about it. All current listeners on the group are removed. 196 + * 197 + * Note: It is not necessary to unregister all multicast groups before 198 + * unregistering the family, unregistering the family will cause 199 + * all assigned multicast groups to be unregistered automatically. 200 + * 201 + * @family: Generic netlink family the group belongs to. 202 + * @grp: The group to unregister, must have been registered successfully 203 + * previously. 204 + */ 205 + void genl_unregister_mc_group(struct genl_family *family, 206 + struct genl_multicast_group *grp) 207 + { 208 + BUG_ON(grp->family != family); 209 + genl_lock(); 210 + netlink_clear_multicast_users(genl_sock, grp->id); 211 + clear_bit(grp->id, mc_groups); 212 + list_del(&grp->list); 213 + genl_ctrl_event(CTRL_CMD_DELMCAST_GRP, grp); 214 + grp->id = 0; 215 + grp->family = NULL; 216 + genl_unlock(); 217 + } 218 + 219 + static void genl_unregister_mc_groups(struct genl_family *family) 220 + { 221 + struct genl_multicast_group *grp, *tmp; 222 + 223 + list_for_each_entry_safe(grp, tmp, &family->mcast_groups, list) 224 + genl_unregister_mc_group(family, grp); 129 225 } 130 226 131 227 /** ··· 336 216 goto errout; 337 217 338 218 INIT_LIST_HEAD(&family->ops_list); 219 + INIT_LIST_HEAD(&family->mcast_groups); 339 220 340 221 genl_lock(); 341 222 ··· 395 274 int genl_unregister_family(struct genl_family *family) 396 275 { 397 276 struct genl_family *rc; 277 + 278 + genl_unregister_mc_groups(family); 398 279 399 280 genl_lock(); 400 281 ··· 533 410 nla_nest_end(skb, nla_ops); 534 411 } 535 412 413 + if (!list_empty(&family->mcast_groups)) { 414 + struct genl_multicast_group *grp; 415 + struct nlattr *nla_grps; 416 + int idx = 1; 417 + 418 + nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS); 419 + if (nla_grps == NULL) 420 + goto nla_put_failure; 421 + 422 + list_for_each_entry(grp, &family->mcast_groups, list) { 423 + struct nlattr *nest; 424 + 425 + nest = nla_nest_start(skb, idx++); 426 + if (nest == NULL) 427 + goto nla_put_failure; 428 + 429 + NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id); 430 + NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME, 431 + grp->name); 432 + 433 + nla_nest_end(skb, nest); 434 + } 435 + nla_nest_end(skb, nla_grps); 436 + } 437 + 438 + return genlmsg_end(skb, hdr); 439 + 440 + nla_put_failure: 441 + return genlmsg_cancel(skb, hdr); 442 + } 443 + 444 + static int ctrl_fill_mcgrp_info(struct genl_multicast_group *grp, u32 pid, 445 + u32 seq, u32 flags, struct sk_buff *skb, 446 + u8 cmd) 447 + { 448 + void *hdr; 449 + struct nlattr *nla_grps; 450 + struct nlattr *nest; 451 + 452 + hdr = genlmsg_put(skb, pid, seq, &genl_ctrl, flags, cmd); 453 + if (hdr == NULL) 454 + return -1; 455 + 456 + NLA_PUT_STRING(skb, CTRL_ATTR_FAMILY_NAME, grp->family->name); 457 + NLA_PUT_U16(skb, CTRL_ATTR_FAMILY_ID, grp->family->id); 458 + 459 + nla_grps = nla_nest_start(skb, CTRL_ATTR_MCAST_GROUPS); 460 + if (nla_grps == NULL) 461 + goto nla_put_failure; 462 + 463 + nest = nla_nest_start(skb, 1); 464 + if (nest == NULL) 465 + goto nla_put_failure; 466 + 467 + NLA_PUT_U32(skb, CTRL_ATTR_MCAST_GRP_ID, grp->id); 468 + NLA_PUT_STRING(skb, CTRL_ATTR_MCAST_GRP_NAME, 469 + grp->name); 470 + 471 + nla_nest_end(skb, nest); 472 + nla_nest_end(skb, nla_grps); 473 + 536 474 return genlmsg_end(skb, hdr); 537 475 538 476 nla_put_failure: ··· 637 453 return skb->len; 638 454 } 639 455 640 - static struct sk_buff *ctrl_build_msg(struct genl_family *family, u32 pid, 641 - int seq, u8 cmd) 456 + static struct sk_buff *ctrl_build_family_msg(struct genl_family *family, 457 + u32 pid, int seq, u8 cmd) 642 458 { 643 459 struct sk_buff *skb; 644 460 int err; ··· 648 464 return ERR_PTR(-ENOBUFS); 649 465 650 466 err = ctrl_fill_info(family, pid, seq, 0, skb, cmd); 467 + if (err < 0) { 468 + nlmsg_free(skb); 469 + return ERR_PTR(err); 470 + } 471 + 472 + return skb; 473 + } 474 + 475 + static struct sk_buff *ctrl_build_mcgrp_msg(struct genl_multicast_group *grp, 476 + u32 pid, int seq, u8 cmd) 477 + { 478 + struct sk_buff *skb; 479 + int err; 480 + 481 + skb = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); 482 + if (skb == NULL) 483 + return ERR_PTR(-ENOBUFS); 484 + 485 + err = ctrl_fill_mcgrp_info(grp, pid, seq, 0, skb, cmd); 651 486 if (err < 0) { 652 487 nlmsg_free(skb); 653 488 return ERR_PTR(err); ··· 704 501 goto errout; 705 502 } 706 503 707 - msg = ctrl_build_msg(res, info->snd_pid, info->snd_seq, 708 - CTRL_CMD_NEWFAMILY); 504 + msg = ctrl_build_family_msg(res, info->snd_pid, info->snd_seq, 505 + CTRL_CMD_NEWFAMILY); 709 506 if (IS_ERR(msg)) { 710 507 err = PTR_ERR(msg); 711 508 goto errout; ··· 726 523 switch (event) { 727 524 case CTRL_CMD_NEWFAMILY: 728 525 case CTRL_CMD_DELFAMILY: 729 - msg = ctrl_build_msg(data, 0, 0, event); 526 + msg = ctrl_build_family_msg(data, 0, 0, event); 527 + if (IS_ERR(msg)) 528 + return PTR_ERR(msg); 529 + 530 + genlmsg_multicast(msg, 0, GENL_ID_CTRL, GFP_KERNEL); 531 + break; 532 + case CTRL_CMD_NEWMCAST_GRP: 533 + case CTRL_CMD_DELMCAST_GRP: 534 + msg = ctrl_build_mcgrp_msg(data, 0, 0, event); 730 535 if (IS_ERR(msg)) 731 536 return PTR_ERR(msg); 732 537 ··· 750 539 .doit = ctrl_getfamily, 751 540 .dumpit = ctrl_dumpfamily, 752 541 .policy = ctrl_policy, 542 + }; 543 + 544 + static struct genl_multicast_group notify_grp = { 545 + .name = "notify", 753 546 }; 754 547 755 548 static int __init genl_init(void) ··· 772 557 goto errout_register; 773 558 774 559 netlink_set_nonroot(NETLINK_GENERIC, NL_NONROOT_RECV); 775 - genl_sock = netlink_kernel_create(NETLINK_GENERIC, GENL_MAX_ID, 776 - genl_rcv, NULL, THIS_MODULE); 560 + 561 + /* we'll bump the group number right afterwards */ 562 + genl_sock = netlink_kernel_create(NETLINK_GENERIC, 0, genl_rcv, 563 + NULL, THIS_MODULE); 777 564 if (genl_sock == NULL) 778 565 panic("GENL: Cannot initialize generic netlink\n"); 566 + 567 + err = genl_register_mc_group(&genl_ctrl, &notify_grp); 568 + if (err < 0) 569 + goto errout_register; 779 570 780 571 return 0; 781 572
+1 -1
net/netrom/af_netrom.c
··· 720 720 721 721 for (;;) { 722 722 prepare_to_wait(sk->sk_sleep, &wait, 723 - TASK_INTERRUPTIBLE); 723 + TASK_INTERRUPTIBLE); 724 724 if (sk->sk_state != TCP_SYN_SENT) 725 725 break; 726 726 if (!signal_pending(current)) {
+1 -1
net/packet/af_packet.c
··· 108 108 Incoming, dev->hard_header==NULL 109 109 mac_header -> UNKNOWN position. It is very likely, that it points to ll 110 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 112 data -> data 113 113 114 114 Outgoing, dev->hard_header==NULL
+1 -1
net/rfkill/rfkill-input.c
··· 83 83 static DEFINE_RFKILL_TASK(rfkill_bt, RFKILL_TYPE_BLUETOOTH); 84 84 85 85 static 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 88 if (type == EV_KEY && down == 1) { 89 89 switch (code) {
+1 -1
net/rfkill/rfkill.c
··· 187 187 static struct device_attribute rfkill_dev_attrs[] = { 188 188 __ATTR(name, S_IRUGO, rfkill_name_show, NULL), 189 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 191 __ATTR(claim, S_IRUGO|S_IWUSR, rfkill_claim_show, rfkill_claim_store), 192 192 __ATTR_NULL 193 193 };
+1 -1
net/rose/af_rose.c
··· 816 816 817 817 for (;;) { 818 818 prepare_to_wait(sk->sk_sleep, &wait, 819 - TASK_INTERRUPTIBLE); 819 + TASK_INTERRUPTIBLE); 820 820 if (sk->sk_state != TCP_SYN_SENT) 821 821 break; 822 822 if (!signal_pending(current)) {
+5 -5
net/rxrpc/af_rxrpc.c
··· 805 805 } 806 806 807 807 ret = proto_register(&rxrpc_proto, 1); 808 - if (ret < 0) { 809 - printk(KERN_CRIT "RxRPC: Cannot register protocol\n"); 808 + if (ret < 0) { 809 + printk(KERN_CRIT "RxRPC: Cannot register protocol\n"); 810 810 goto error_proto; 811 811 } 812 812 813 813 ret = sock_register(&rxrpc_family_ops); 814 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 816 goto error_sock; 817 817 } 818 818 819 819 ret = register_key_type(&key_type_rxrpc); 820 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 822 goto error_key_type; 823 823 } 824 824 825 825 ret = register_key_type(&key_type_rxrpc_s); 826 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 828 goto error_key_type_s; 829 829 } 830 830
+1 -1
net/sctp/sm_statefuns.c
··· 1779 1779 SCTP_COMM_UP, 0, 1780 1780 asoc->c.sinit_num_ostreams, 1781 1781 asoc->c.sinit_max_instreams, 1782 - NULL, GFP_ATOMIC); 1782 + NULL, GFP_ATOMIC); 1783 1783 if (!ev) 1784 1784 goto nomem; 1785 1785
+2 -2
net/sctp/socket.c
··· 4803 4803 char __user *optval, 4804 4804 int __user *optlen) 4805 4805 { 4806 - u32 val; 4806 + u32 val; 4807 4807 4808 4808 if (len < sizeof(u32)) 4809 4809 return -EINVAL; ··· 4827 4827 char __user *optval, 4828 4828 int __user *optlen) 4829 4829 { 4830 - int val; 4830 + int val; 4831 4831 4832 4832 if (len < sizeof(int)) 4833 4833 return -EINVAL;
+1 -1
net/sunrpc/auth_gss/gss_krb5_crypto.c
··· 67 67 68 68 if (crypto_blkcipher_ivsize(tfm) > 16) { 69 69 dprintk("RPC: gss_k5encrypt: tfm iv size to large %d\n", 70 - crypto_blkcipher_ivsize(tfm)); 70 + crypto_blkcipher_ivsize(tfm)); 71 71 goto out; 72 72 } 73 73
+6 -6
net/tipc/socket.c
··· 1629 1629 .getsockopt = getsockopt, 1630 1630 .sendmsg = send_msg, 1631 1631 .recvmsg = recv_msg, 1632 - .mmap = sock_no_mmap, 1633 - .sendpage = sock_no_sendpage 1632 + .mmap = sock_no_mmap, 1633 + .sendpage = sock_no_sendpage 1634 1634 }; 1635 1635 1636 1636 static struct proto_ops packet_ops = { ··· 1650 1650 .getsockopt = getsockopt, 1651 1651 .sendmsg = send_packet, 1652 1652 .recvmsg = recv_msg, 1653 - .mmap = sock_no_mmap, 1654 - .sendpage = sock_no_sendpage 1653 + .mmap = sock_no_mmap, 1654 + .sendpage = sock_no_sendpage 1655 1655 }; 1656 1656 1657 1657 static struct proto_ops stream_ops = { ··· 1671 1671 .getsockopt = getsockopt, 1672 1672 .sendmsg = send_stream, 1673 1673 .recvmsg = recv_stream, 1674 - .mmap = sock_no_mmap, 1675 - .sendpage = sock_no_sendpage 1674 + .mmap = sock_no_mmap, 1675 + .sendpage = sock_no_sendpage 1676 1676 }; 1677 1677 1678 1678 static struct net_proto_family tipc_family_ops = {
+1 -1
net/xfrm/xfrm_policy.c
··· 857 857 pol, NULL); 858 858 return err; 859 859 } 860 - } 860 + } 861 861 for (i = xfrm_policy_bydst[dir].hmask; i >= 0; i--) { 862 862 hlist_for_each_entry(pol, entry, 863 863 xfrm_policy_bydst[dir].table + i,
+1 -1
net/xfrm/xfrm_state.c
··· 407 407 xfrm_audit_log(audit_info->loginuid, 408 408 audit_info->secid, 409 409 AUDIT_MAC_IPSEC_DELSA, 410 - 0, NULL, x); 410 + 0, NULL, x); 411 411 412 412 return err; 413 413 }