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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
net: Kill ratelimit.h dependency in linux/net.h
net: Add linux/sysctl.h includes where needed.
net: Kill ether_table[] declaration.
inetpeer: fix race in unused_list manipulations
atm: expose ATM device index in sysfs
IPVS: bug in ip_vs_ftp, same list heaad used in all netns.
bug.h: Move ratelimit warn interfaces to ratelimit.h
bonding: cleanup module option descriptions
net:8021q:vlan.c Fix pr_info to just give the vlan fullname and version.
net: davinci_emac: fix dev_err use at probe
can: convert to %pK for kptr_restrict support
net: fix ETHTOOL_SFEATURES compatibility with old ethtool_ops.set_flags
netfilter: Fix several warnings in compat_mtw_from_user().
netfilter: ipset: fix ip_set_flush return code
netfilter: ipset: remove unused variable from type_pf_tdel()
netfilter: ipset: Use proper timeout value to jiffies conversion

+189 -119
+22 -12
drivers/net/bonding/bond_main.c
··· 113 113 module_param(tx_queues, int, 0); 114 114 MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)"); 115 115 module_param_named(num_grat_arp, num_peer_notif, int, 0644); 116 - MODULE_PARM_DESC(num_grat_arp, "Number of peer notifications to send on failover event (alias of num_unsol_na)"); 116 + MODULE_PARM_DESC(num_grat_arp, "Number of peer notifications to send on " 117 + "failover event (alias of num_unsol_na)"); 117 118 module_param_named(num_unsol_na, num_peer_notif, int, 0644); 118 - MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on failover event (alias of num_grat_arp)"); 119 + MODULE_PARM_DESC(num_unsol_na, "Number of peer notifications to send on " 120 + "failover event (alias of num_grat_arp)"); 119 121 module_param(miimon, int, 0); 120 122 MODULE_PARM_DESC(miimon, "Link check interval in milliseconds"); 121 123 module_param(updelay, int, 0); ··· 129 127 MODULE_PARM_DESC(use_carrier, "Use netif_carrier_ok (vs MII ioctls) in miimon; " 130 128 "0 for off, 1 for on (default)"); 131 129 module_param(mode, charp, 0); 132 - MODULE_PARM_DESC(mode, "Mode of operation : 0 for balance-rr, " 130 + MODULE_PARM_DESC(mode, "Mode of operation; 0 for balance-rr, " 133 131 "1 for active-backup, 2 for balance-xor, " 134 132 "3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, " 135 133 "6 for balance-alb"); ··· 144 142 "2 for only on active slave " 145 143 "failure"); 146 144 module_param(lacp_rate, charp, 0); 147 - MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner " 148 - "(slow/fast)"); 145 + MODULE_PARM_DESC(lacp_rate, "LACPDU tx rate to request from 802.3ad partner; " 146 + "0 for slow, 1 for fast"); 149 147 module_param(ad_select, charp, 0); 150 - MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic: stable (0, default), bandwidth (1), count (2)"); 148 + MODULE_PARM_DESC(ad_select, "803.ad aggregation selection logic; " 149 + "0 for stable (default), 1 for bandwidth, " 150 + "2 for count"); 151 151 module_param(xmit_hash_policy, charp, 0); 152 - MODULE_PARM_DESC(xmit_hash_policy, "XOR hashing method: 0 for layer 2 (default)" 153 - ", 1 for layer 3+4"); 152 + MODULE_PARM_DESC(xmit_hash_policy, "balance-xor and 802.3ad hashing method; " 153 + "0 for layer 2 (default), 1 for layer 3+4, " 154 + "2 for layer 2+3"); 154 155 module_param(arp_interval, int, 0); 155 156 MODULE_PARM_DESC(arp_interval, "arp interval in milliseconds"); 156 157 module_param_array(arp_ip_target, charp, NULL, 0); 157 158 MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form"); 158 159 module_param(arp_validate, charp, 0); 159 - MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes: none (default), active, backup or all"); 160 + MODULE_PARM_DESC(arp_validate, "validate src/dst of ARP probes; " 161 + "0 for none (default), 1 for active, " 162 + "2 for backup, 3 for all"); 160 163 module_param(fail_over_mac, charp, 0); 161 - MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to the same MAC. none (default), active or follow"); 164 + MODULE_PARM_DESC(fail_over_mac, "For active-backup, do not set all slaves to " 165 + "the same MAC; 0 for none (default), " 166 + "1 for active, 2 for follow"); 162 167 module_param(all_slaves_active, int, 0); 163 168 MODULE_PARM_DESC(all_slaves_active, "Keep all frames received on an interface" 164 - "by setting active flag for all slaves. " 169 + "by setting active flag for all slaves; " 165 170 "0 for never (default), 1 for always."); 166 171 module_param(resend_igmp, int, 0); 167 - MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link failure"); 172 + MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on " 173 + "link failure"); 168 174 169 175 /*----------------------------- Global variables ----------------------------*/ 170 176
+11 -11
drivers/net/davinci_emac.c
··· 1772 1772 /* obtain emac clock from kernel */ 1773 1773 emac_clk = clk_get(&pdev->dev, NULL); 1774 1774 if (IS_ERR(emac_clk)) { 1775 - printk(KERN_ERR "DaVinci EMAC: Failed to get EMAC clock\n"); 1775 + dev_err(&pdev->dev, "failed to get EMAC clock\n"); 1776 1776 return -EBUSY; 1777 1777 } 1778 1778 emac_bus_frequency = clk_get_rate(emac_clk); ··· 1780 1780 1781 1781 ndev = alloc_etherdev(sizeof(struct emac_priv)); 1782 1782 if (!ndev) { 1783 - printk(KERN_ERR "DaVinci EMAC: Error allocating net_device\n"); 1783 + dev_err(&pdev->dev, "error allocating net_device\n"); 1784 1784 clk_put(emac_clk); 1785 1785 return -ENOMEM; 1786 1786 } ··· 1795 1795 1796 1796 pdata = pdev->dev.platform_data; 1797 1797 if (!pdata) { 1798 - printk(KERN_ERR "DaVinci EMAC: No platform data\n"); 1798 + dev_err(&pdev->dev, "no platform data\n"); 1799 1799 return -ENODEV; 1800 1800 } 1801 1801 ··· 1814 1814 /* Get EMAC platform data */ 1815 1815 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1816 1816 if (!res) { 1817 - dev_err(emac_dev, "DaVinci EMAC: Error getting res\n"); 1817 + dev_err(&pdev->dev,"error getting res\n"); 1818 1818 rc = -ENOENT; 1819 1819 goto probe_quit; 1820 1820 } ··· 1822 1822 priv->emac_base_phys = res->start + pdata->ctrl_reg_offset; 1823 1823 size = res->end - res->start + 1; 1824 1824 if (!request_mem_region(res->start, size, ndev->name)) { 1825 - dev_err(emac_dev, "DaVinci EMAC: failed request_mem_region() for regs\n"); 1825 + dev_err(&pdev->dev, "failed request_mem_region() for regs\n"); 1826 1826 rc = -ENXIO; 1827 1827 goto probe_quit; 1828 1828 } 1829 1829 1830 1830 priv->remap_addr = ioremap(res->start, size); 1831 1831 if (!priv->remap_addr) { 1832 - dev_err(emac_dev, "Unable to map IO\n"); 1832 + dev_err(&pdev->dev, "unable to map IO\n"); 1833 1833 rc = -ENOMEM; 1834 1834 release_mem_region(res->start, size); 1835 1835 goto probe_quit; ··· 1863 1863 1864 1864 priv->dma = cpdma_ctlr_create(&dma_params); 1865 1865 if (!priv->dma) { 1866 - dev_err(emac_dev, "DaVinci EMAC: Error initializing DMA\n"); 1866 + dev_err(&pdev->dev, "error initializing DMA\n"); 1867 1867 rc = -ENOMEM; 1868 1868 goto no_dma; 1869 1869 } ··· 1879 1879 1880 1880 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 1881 1881 if (!res) { 1882 - dev_err(emac_dev, "DaVinci EMAC: Error getting irq res\n"); 1882 + dev_err(&pdev->dev, "error getting irq res\n"); 1883 1883 rc = -ENOENT; 1884 1884 goto no_irq_res; 1885 1885 } ··· 1888 1888 if (!is_valid_ether_addr(priv->mac_addr)) { 1889 1889 /* Use random MAC if none passed */ 1890 1890 random_ether_addr(priv->mac_addr); 1891 - printk(KERN_WARNING "%s: using random MAC addr: %pM\n", 1892 - __func__, priv->mac_addr); 1891 + dev_warn(&pdev->dev, "using random MAC addr: %pM\n", 1892 + priv->mac_addr); 1893 1893 } 1894 1894 1895 1895 ndev->netdev_ops = &emac_netdev_ops; ··· 1902 1902 SET_NETDEV_DEV(ndev, &pdev->dev); 1903 1903 rc = register_netdev(ndev); 1904 1904 if (rc) { 1905 - dev_err(emac_dev, "DaVinci EMAC: Error in register_netdev\n"); 1905 + dev_err(&pdev->dev, "error in register_netdev\n"); 1906 1906 rc = -ENODEV; 1907 1907 goto netdev_reg_err; 1908 1908 }
-40
include/asm-generic/bug.h
··· 162 162 unlikely(__ret_warn_once); \ 163 163 }) 164 164 165 - #ifdef CONFIG_PRINTK 166 - 167 - #define WARN_ON_RATELIMIT(condition, state) \ 168 - WARN_ON((condition) && __ratelimit(state)) 169 - 170 - #define __WARN_RATELIMIT(condition, state, format...) \ 171 - ({ \ 172 - int rtn = 0; \ 173 - if (unlikely(__ratelimit(state))) \ 174 - rtn = WARN(condition, format); \ 175 - rtn; \ 176 - }) 177 - 178 - #define WARN_RATELIMIT(condition, format...) \ 179 - ({ \ 180 - static DEFINE_RATELIMIT_STATE(_rs, \ 181 - DEFAULT_RATELIMIT_INTERVAL, \ 182 - DEFAULT_RATELIMIT_BURST); \ 183 - __WARN_RATELIMIT(condition, &_rs, format); \ 184 - }) 185 - 186 - #else 187 - 188 - #define WARN_ON_RATELIMIT(condition, state) \ 189 - WARN_ON(condition) 190 - 191 - #define __WARN_RATELIMIT(condition, state, format...) \ 192 - ({ \ 193 - int rtn = WARN(condition, format); \ 194 - rtn; \ 195 - }) 196 - 197 - #define WARN_RATELIMIT(condition, format...) \ 198 - ({ \ 199 - int rtn = WARN(condition, format); \ 200 - rtn; \ 201 - }) 202 - 203 - #endif 204 - 205 165 /* 206 166 * WARN_ON_SMP() is for cases that the warning is either 207 167 * meaningless for !SMP or may even cause failures.
-4
include/linux/if_ether.h
··· 132 132 133 133 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); 134 134 135 - #ifdef CONFIG_SYSCTL 136 - extern struct ctl_table ether_table[]; 137 - #endif 138 - 139 135 int mac_pton(const char *s, u8 *mac); 140 136 extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); 141 137
-6
include/linux/net.h
··· 289 289 MODULE_ALIAS("net-pf-" __stringify(pf) "-proto-" __stringify(proto) \ 290 290 "-type-" __stringify(type)) 291 291 292 - #ifdef CONFIG_SYSCTL 293 - #include <linux/sysctl.h> 294 - #include <linux/ratelimit.h> 295 - extern struct ratelimit_state net_ratelimit_state; 296 - #endif 297 - 298 292 #endif /* __KERNEL__ */ 299 293 #endif /* _LINUX_NET_H */
+1
include/linux/netfilter.h
··· 13 13 #endif 14 14 #include <linux/types.h> 15 15 #include <linux/compiler.h> 16 + #include <linux/sysctl.h> 16 17 17 18 /* Responses from hook functions. */ 18 19 #define NF_DROP 0
+2 -2
include/linux/netfilter/ipset/ip_set_ahash.h
··· 839 839 struct htable *t = h->table; 840 840 const struct type_pf_elem *d = value; 841 841 struct hbucket *n; 842 - int i, ret = 0; 842 + int i; 843 843 struct type_pf_elem *data; 844 844 u32 key; 845 845 ··· 850 850 if (!type_pf_data_equal(data, d)) 851 851 continue; 852 852 if (type_pf_data_expired(data)) 853 - ret = -IPSET_ERR_EXIST; 853 + return -IPSET_ERR_EXIST; 854 854 if (i != n->pos - 1) 855 855 /* Not last one */ 856 856 type_pf_data_copy(data, ahash_tdata(n, n->pos - 1));
+10 -8
include/linux/netfilter/ipset/ip_set_timeout.h
··· 45 45 { 46 46 return timeout != IPSET_ELEM_UNSET && 47 47 (timeout == IPSET_ELEM_PERMANENT || 48 - time_after(timeout, jiffies)); 48 + time_is_after_jiffies(timeout)); 49 49 } 50 50 51 51 static inline bool ··· 53 53 { 54 54 return timeout != IPSET_ELEM_UNSET && 55 55 timeout != IPSET_ELEM_PERMANENT && 56 - time_before(timeout, jiffies); 56 + time_is_before_jiffies(timeout); 57 57 } 58 58 59 59 static inline unsigned long ··· 64 64 if (!timeout) 65 65 return IPSET_ELEM_PERMANENT; 66 66 67 - t = timeout * HZ + jiffies; 67 + t = msecs_to_jiffies(timeout * 1000) + jiffies; 68 68 if (t == IPSET_ELEM_UNSET || t == IPSET_ELEM_PERMANENT) 69 69 /* Bingo! */ 70 70 t++; ··· 75 75 static inline u32 76 76 ip_set_timeout_get(unsigned long timeout) 77 77 { 78 - return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; 78 + return timeout == IPSET_ELEM_PERMANENT ? 0 : 79 + jiffies_to_msecs(timeout - jiffies)/1000; 79 80 } 80 81 81 82 #else ··· 90 89 ip_set_timeout_test(unsigned long timeout) 91 90 { 92 91 return timeout == IPSET_ELEM_PERMANENT || 93 - time_after(timeout, jiffies); 92 + time_is_after_jiffies(timeout); 94 93 } 95 94 96 95 static inline bool 97 96 ip_set_timeout_expired(unsigned long timeout) 98 97 { 99 98 return timeout != IPSET_ELEM_PERMANENT && 100 - time_before(timeout, jiffies); 99 + time_is_before_jiffies(timeout); 101 100 } 102 101 103 102 static inline unsigned long ··· 108 107 if (!timeout) 109 108 return IPSET_ELEM_PERMANENT; 110 109 111 - t = timeout * HZ + jiffies; 110 + t = msecs_to_jiffies(timeout * 1000) + jiffies; 112 111 if (t == IPSET_ELEM_PERMANENT) 113 112 /* Bingo! :-) */ 114 113 t++; ··· 119 118 static inline u32 120 119 ip_set_timeout_get(unsigned long timeout) 121 120 { 122 - return timeout == IPSET_ELEM_PERMANENT ? 0 : (timeout - jiffies)/HZ; 121 + return timeout == IPSET_ELEM_PERMANENT ? 0 : 122 + jiffies_to_msecs(timeout - jiffies)/1000; 123 123 } 124 124 #endif /* ! IP_SET_BITMAP_TIMEOUT */ 125 125
+40
include/linux/ratelimit.h
··· 41 41 extern int ___ratelimit(struct ratelimit_state *rs, const char *func); 42 42 #define __ratelimit(state) ___ratelimit(state, __func__) 43 43 44 + #ifdef CONFIG_PRINTK 45 + 46 + #define WARN_ON_RATELIMIT(condition, state) \ 47 + WARN_ON((condition) && __ratelimit(state)) 48 + 49 + #define __WARN_RATELIMIT(condition, state, format...) \ 50 + ({ \ 51 + int rtn = 0; \ 52 + if (unlikely(__ratelimit(state))) \ 53 + rtn = WARN(condition, format); \ 54 + rtn; \ 55 + }) 56 + 57 + #define WARN_RATELIMIT(condition, format...) \ 58 + ({ \ 59 + static DEFINE_RATELIMIT_STATE(_rs, \ 60 + DEFAULT_RATELIMIT_INTERVAL, \ 61 + DEFAULT_RATELIMIT_BURST); \ 62 + __WARN_RATELIMIT(condition, &_rs, format); \ 63 + }) 64 + 65 + #else 66 + 67 + #define WARN_ON_RATELIMIT(condition, state) \ 68 + WARN_ON(condition) 69 + 70 + #define __WARN_RATELIMIT(condition, state, format...) \ 71 + ({ \ 72 + int rtn = WARN(condition, format); \ 73 + rtn; \ 74 + }) 75 + 76 + #define WARN_RATELIMIT(condition, format...) \ 77 + ({ \ 78 + int rtn = WARN(condition, format); \ 79 + rtn; \ 80 + }) 81 + 82 + #endif 83 + 44 84 #endif /* _LINUX_RATELIMIT_H */
+2 -1
include/net/ip_vs.h
··· 797 797 struct list_head rs_table[IP_VS_RTAB_SIZE]; 798 798 /* ip_vs_app */ 799 799 struct list_head app_list; 800 - 800 + /* ip_vs_ftp */ 801 + struct ip_vs_app *ftp_app; 801 802 /* ip_vs_proto */ 802 803 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */ 803 804 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
+1
include/net/net_namespace.h
··· 7 7 #include <asm/atomic.h> 8 8 #include <linux/workqueue.h> 9 9 #include <linux/list.h> 10 + #include <linux/sysctl.h> 10 11 11 12 #include <net/netns/core.h> 12 13 #include <net/netns/mib.h>
+8
include/net/net_ratelimit.h
··· 1 + #ifndef _LINUX_NET_RATELIMIT_H 2 + #define _LINUX_NET_RATELIMIT_H 3 + 4 + #include <linux/ratelimit.h> 5 + 6 + extern struct ratelimit_state net_ratelimit_state; 7 + 8 + #endif /* _LINUX_NET_RATELIMIT_H */
+1 -4
net/8021q/vlan.c
··· 46 46 47 47 const char vlan_fullname[] = "802.1Q VLAN Support"; 48 48 const char vlan_version[] = DRV_VERSION; 49 - static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; 50 - static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; 51 49 52 50 /* End of global variables definitions. */ 53 51 ··· 671 673 { 672 674 int err; 673 675 674 - pr_info("%s v%s %s\n", vlan_fullname, vlan_version, vlan_copyright); 675 - pr_info("All bugs added by %s\n", vlan_buggyright); 676 + pr_info("%s v%s\n", vlan_fullname, vlan_version); 676 677 677 678 err = register_pernet_subsys(&vlan_net_ops); 678 679 if (err < 0)
+10
net/atm/atm_sysfs.c
··· 59 59 return pos - buf; 60 60 } 61 61 62 + static ssize_t show_atmindex(struct device *cdev, 63 + struct device_attribute *attr, char *buf) 64 + { 65 + struct atm_dev *adev = to_atm_dev(cdev); 66 + 67 + return sprintf(buf, "%d\n", adev->number); 68 + } 69 + 62 70 static ssize_t show_carrier(struct device *cdev, 63 71 struct device_attribute *attr, char *buf) 64 72 { ··· 107 99 108 100 static DEVICE_ATTR(address, S_IRUGO, show_address, NULL); 109 101 static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL); 102 + static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL); 110 103 static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL); 111 104 static DEVICE_ATTR(type, S_IRUGO, show_type, NULL); 112 105 static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL); ··· 115 106 static struct device_attribute *atm_attrs[] = { 116 107 &dev_attr_atmaddress, 117 108 &dev_attr_address, 109 + &dev_attr_atmindex, 118 110 &dev_attr_carrier, 119 111 &dev_attr_type, 120 112 &dev_attr_link_rate,
+4 -2
net/bridge/netfilter/ebtables.c
··· 1883 1883 struct xt_target *wt; 1884 1884 void *dst = NULL; 1885 1885 int off, pad = 0; 1886 - unsigned int size_kern, entry_offset, match_size = mwt->match_size; 1886 + unsigned int size_kern, match_size = mwt->match_size; 1887 1887 1888 1888 strlcpy(name, mwt->u.name, sizeof(name)); 1889 1889 1890 1890 if (state->buf_kern_start) 1891 1891 dst = state->buf_kern_start + state->buf_kern_offset; 1892 1892 1893 - entry_offset = (unsigned char *) mwt - base; 1894 1893 switch (compat_mwt) { 1895 1894 case EBT_COMPAT_MATCH: 1896 1895 match = try_then_request_module(xt_find_match(NFPROTO_BRIDGE, ··· 1932 1933 size_kern = wt->targetsize; 1933 1934 module_put(wt->me); 1934 1935 break; 1936 + 1937 + default: 1938 + return -EINVAL; 1935 1939 } 1936 1940 1937 1941 state->buf_kern_offset += match_size + off;
+3 -4
net/can/proc.c
··· 204 204 205 205 hlist_for_each_entry_rcu(r, n, rx_list, list) { 206 206 char *fmt = (r->can_id & CAN_EFF_FLAG)? 207 - " %-5s %08X %08x %08x %08x %8ld %s\n" : 208 - " %-5s %03X %08x %08lx %08lx %8ld %s\n"; 207 + " %-5s %08x %08x %pK %pK %8ld %s\n" : 208 + " %-5s %03x %08x %pK %pK %8ld %s\n"; 209 209 210 210 seq_printf(m, fmt, DNAME(dev), r->can_id, r->mask, 211 - (unsigned long)r->func, (unsigned long)r->data, 212 - r->matches, r->ident); 211 + r->func, r->data, r->matches, r->ident); 213 212 } 214 213 } 215 214
+24 -1
net/core/ethtool.c
··· 233 233 return 1; 234 234 } 235 235 236 + static int ethtool_set_flags_compat(struct net_device *dev, 237 + int (*legacy_set)(struct net_device *, u32), 238 + struct ethtool_set_features_block *features, u32 mask) 239 + { 240 + u32 value; 241 + 242 + if (!legacy_set) 243 + return 0; 244 + 245 + if (!(features[0].valid & mask)) 246 + return 0; 247 + 248 + value = dev->features & ~features[0].valid; 249 + value |= features[0].requested; 250 + 251 + features[0].valid &= ~mask; 252 + 253 + if (legacy_set(dev, value & mask) < 0) 254 + netdev_info(dev, "Legacy flags change failed\n"); 255 + 256 + return 1; 257 + } 258 + 236 259 static int ethtool_set_features_compat(struct net_device *dev, 237 260 struct ethtool_set_features_block *features) 238 261 { ··· 272 249 features, NETIF_F_ALL_TSO); 273 250 compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_rx_csum, 274 251 features, NETIF_F_RXCSUM); 275 - compat |= ethtool_set_feature_compat(dev, dev->ethtool_ops->set_flags, 252 + compat |= ethtool_set_flags_compat(dev, dev->ethtool_ops->set_flags, 276 253 features, flags_dup_features); 277 254 278 255 return compat;
+1
net/core/filter.c
··· 38 38 #include <asm/unaligned.h> 39 39 #include <linux/filter.h> 40 40 #include <linux/reciprocal_div.h> 41 + #include <linux/ratelimit.h> 41 42 42 43 /* No hurry in this branch */ 43 44 static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size)
+1
net/core/sysctl_net_core.c
··· 17 17 18 18 #include <net/ip.h> 19 19 #include <net/sock.h> 20 + #include <net/net_ratelimit.h> 20 21 21 22 #ifdef CONFIG_RPS 22 23 static int rps_sock_flow_sysctl(ctl_table *table, int write,
+1
net/core/utils.c
··· 27 27 #include <linux/ratelimit.h> 28 28 29 29 #include <net/sock.h> 30 + #include <net/net_ratelimit.h> 30 31 31 32 #include <asm/byteorder.h> 32 33 #include <asm/system.h>
+27 -15
net/ipv4/inetpeer.c
··· 154 154 /* Called with or without local BH being disabled. */ 155 155 static void unlink_from_unused(struct inet_peer *p) 156 156 { 157 - if (!list_empty(&p->unused)) { 158 - spin_lock_bh(&unused_peers.lock); 159 - list_del_init(&p->unused); 160 - spin_unlock_bh(&unused_peers.lock); 161 - } 157 + spin_lock_bh(&unused_peers.lock); 158 + list_del_init(&p->unused); 159 + spin_unlock_bh(&unused_peers.lock); 162 160 } 163 161 164 162 static int addr_compare(const struct inetpeer_addr *a, ··· 203 205 u; \ 204 206 }) 205 207 208 + static bool atomic_add_unless_return(atomic_t *ptr, int a, int u, int *newv) 209 + { 210 + int cur, old = atomic_read(ptr); 211 + 212 + while (old != u) { 213 + *newv = old + a; 214 + cur = atomic_cmpxchg(ptr, old, *newv); 215 + if (cur == old) 216 + return true; 217 + old = cur; 218 + } 219 + return false; 220 + } 221 + 206 222 /* 207 223 * Called with rcu_read_lock() 208 224 * Because we hold no lock against a writer, its quite possible we fall ··· 225 213 * We exit from this function if number of links exceeds PEER_MAXDEPTH 226 214 */ 227 215 static struct inet_peer *lookup_rcu(const struct inetpeer_addr *daddr, 228 - struct inet_peer_base *base) 216 + struct inet_peer_base *base, 217 + int *newrefcnt) 229 218 { 230 219 struct inet_peer *u = rcu_dereference(base->root); 231 220 int count = 0; ··· 239 226 * distinction between an unused entry (refcnt=0) and 240 227 * a freed one. 241 228 */ 242 - if (unlikely(!atomic_add_unless(&u->refcnt, 1, -1))) 229 + if (!atomic_add_unless_return(&u->refcnt, 1, -1, newrefcnt)) 243 230 u = NULL; 244 231 return u; 245 232 } ··· 478 465 struct inet_peer_base *base = family_to_base(daddr->family); 479 466 struct inet_peer *p; 480 467 unsigned int sequence; 481 - int invalidated; 468 + int invalidated, newrefcnt = 0; 482 469 483 470 /* Look up for the address quickly, lockless. 484 471 * Because of a concurrent writer, we might not find an existing entry. 485 472 */ 486 473 rcu_read_lock(); 487 474 sequence = read_seqbegin(&base->lock); 488 - p = lookup_rcu(daddr, base); 475 + p = lookup_rcu(daddr, base, &newrefcnt); 489 476 invalidated = read_seqretry(&base->lock, sequence); 490 477 rcu_read_unlock(); 491 478 492 479 if (p) { 493 - /* The existing node has been found. 480 + found: /* The existing node has been found. 494 481 * Remove the entry from unused list if it was there. 495 482 */ 496 - unlink_from_unused(p); 483 + if (newrefcnt == 1) 484 + unlink_from_unused(p); 497 485 return p; 498 486 } 499 487 ··· 508 494 write_seqlock_bh(&base->lock); 509 495 p = lookup(daddr, stack, base); 510 496 if (p != peer_avl_empty) { 511 - atomic_inc(&p->refcnt); 497 + newrefcnt = atomic_inc_return(&p->refcnt); 512 498 write_sequnlock_bh(&base->lock); 513 - /* Remove the entry from unused list if it was there. */ 514 - unlink_from_unused(p); 515 - return p; 499 + goto found; 516 500 } 517 501 p = create ? kmem_cache_alloc(peer_cachep, GFP_ATOMIC) : NULL; 518 502 if (p) {
+1 -1
net/netfilter/ipset/ip_set_core.c
··· 815 815 ip_set_id_t i; 816 816 817 817 if (unlikely(protocol_failed(attr))) 818 - return -EPROTO; 818 + return -IPSET_ERR_PROTOCOL; 819 819 820 820 if (!attr[IPSET_ATTR_SETNAME]) { 821 821 for (i = 0; i < ip_set_max; i++)
+19 -8
net/netfilter/ipvs/ip_vs_ftp.c
··· 411 411 static int __net_init __ip_vs_ftp_init(struct net *net) 412 412 { 413 413 int i, ret; 414 - struct ip_vs_app *app = &ip_vs_ftp; 414 + struct ip_vs_app *app; 415 + struct netns_ipvs *ipvs = net_ipvs(net); 416 + 417 + app = kmemdup(&ip_vs_ftp, sizeof(struct ip_vs_app), GFP_KERNEL); 418 + if (!app) 419 + return -ENOMEM; 420 + INIT_LIST_HEAD(&app->a_list); 421 + INIT_LIST_HEAD(&app->incs_list); 422 + ipvs->ftp_app = app; 415 423 416 424 ret = register_ip_vs_app(net, app); 417 425 if (ret) 418 - return ret; 426 + goto err_exit; 419 427 420 428 for (i=0; i<IP_VS_APP_MAX_PORTS; i++) { 421 429 if (!ports[i]) 422 430 continue; 423 431 ret = register_ip_vs_app_inc(net, app, app->protocol, ports[i]); 424 432 if (ret) 425 - break; 433 + goto err_unreg; 426 434 pr_info("%s: loaded support on port[%d] = %d\n", 427 435 app->name, i, ports[i]); 428 436 } 437 + return 0; 429 438 430 - if (ret) 431 - unregister_ip_vs_app(net, app); 432 - 439 + err_unreg: 440 + unregister_ip_vs_app(net, app); 441 + err_exit: 442 + kfree(ipvs->ftp_app); 433 443 return ret; 434 444 } 435 445 /* ··· 447 437 */ 448 438 static void __ip_vs_ftp_exit(struct net *net) 449 439 { 450 - struct ip_vs_app *app = &ip_vs_ftp; 440 + struct netns_ipvs *ipvs = net_ipvs(net); 451 441 452 - unregister_ip_vs_app(net, app); 442 + unregister_ip_vs_app(net, ipvs->ftp_app); 443 + kfree(ipvs->ftp_app); 453 444 } 454 445 455 446 static struct pernet_operations ip_vs_ftp_ops = {