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