History

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

Pull networking fixes from David Miller: 1) Don't leak ipvs->sysctl_tbl, from Tommi Rentala. 2) Fix neighbour table entry leak in rocker driver, from Ying Xue. 3) Do not emit bonding notifications for unregistered interfaces, from Nicolas Dichtel. 4) Set ipv6 flow label properly when in TIME_WAIT state, from Florent Fourcot. 5) Fix regression in ipv6 multicast filter test, from Henning Rogge. 6) do_replace() in various footables netfilter modules is missing a check for 0 counters in the datastructure provided by the user. Fix from Dave Jones, and found with trinity. 7) Fix RCU bug in packet scheduler classifier module unloads, from Daniel Borkmann. 8) Avoid deadlock in tcp_get_info() by using u64_sync. From Eric Dumzaet. 9) Input packet processing can race with inetdev_destroy() teardown, fix potential OOPS in ip_error() by explicitly testing whether the inetdev is still attached. From Eric W Biederman. 10) MLDv2 parser in bridge multicast code breaks too early while parsing. Fix from Thadeu Lima de Souza Cascardo. 11) Asking for settings on non-zero PHYID doesn't work because we do not import the command structure from the user and use the PHYID provided there. Fix from Arun Parameswaran. 12) Fix UDP checksums with IPV6 RAW sockets, from Vlad Yasevich. 13) Missing NF_TABLES depends for TPROXY etc can cause build failures, fix from Florian Westphal. 14) Fix netfilter conntrack to handle RFC5961 challenge ACKs properly, from Jesper Dangaard Brouer. 15) If netlink autobind retry fails, we have to reset the sockets portid back to zero. From Herbert Xu. 16) VXLAN netns exit code unregisters using wrong device, from John W Linville. 17) Add some USB device IDs to ath3k and btusb bluetooth drivers, from Dmitry Tunin and Wen-chien Jesse Sung. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits) bridge: fix lockdep splat net: core: 'ethtool' issue with querying phy settings bridge: fix parsing of MLDv2 reports ARM: zynq: DT: Use the zynq binding with macb net: macb: Disable half duplex gigabit on Zynq net: macb: Document zynq gem dt binding ipv4: fill in table id when replacing a route cdc_ncm: Fix tx_bytes statistics ipv4: Avoid crashing in ip_error tcp: fix a potential deadlock in tcp_get_info() net: sched: fix call_rcu() race on classifier module unloads net: phy: Make sure phy_start() always re-enables the phy interrupts ipv6: fix ECMP route replacement ipv6: do not delete previously existing ECMP routes if add fails Revert "netfilter: bridge: query conntrack about skb dnat" netfilter: ensure number of counters is >0 in do_replace() netfilter: nfnetlink_{log,queue}: Register pernet in first place tcp: don't over-send F-RTO probes tcp: only undo on partial ACKs in CA_Loss net/ipv6/udp: Fix ipv6 multicast socket filter regression ...

Linus Torvalds committed 11 years ago

Commit 0b6280c2 parents 1c8df7b 93a33a551 files · +308 −105Browse files

Unified · Split

51 files
  1. Documentation/devicetree/bindings/net/cdns-emac.txt +2 −1
  2. arch/arm/boot/dts/zynq-7000.dtsi +2 −2
  3. drivers/bluetooth/ath3k.c +4 −0
  4. drivers/bluetooth/btusb.c +3 −0
  5. drivers/net/bonding/bond_options.c +1 −1
  6. drivers/net/ethernet/cadence/macb.c +18 −0
  7. drivers/net/ethernet/cadence/macb.h +1 −0
  8. drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +4 −4
  9. drivers/net/ethernet/rocker/rocker.c +5 −3
  10. drivers/net/phy/phy.c +19 −15
  11. drivers/net/usb/cdc_ncm.c +1 −1
  12. drivers/net/vxlan.c +1 −1
  13. include/linux/rhashtable.h +19 −0
  14. include/linux/skbuff.h +1 −0
  15. include/linux/tcp.h +2 −0
  16. include/net/inet_connection_sock.h +3 −2
  17. include/uapi/linux/netfilter/nf_conntrack_tcp.h +3 −0
  18. include/uapi/linux/rtnetlink.h +1 −1
  19. lib/rhashtable.c +11 −0
  20. net/8021q/vlan.c +1 −1
  21. net/bluetooth/hci_core.c +4 −2
  22. net/bridge/br_multicast.c +1 −1
  23. net/bridge/br_netfilter.c +9 −18
  24. net/bridge/br_stp_timer.c +2 −0
  25. net/bridge/netfilter/ebtables.c +4 −0
  26. net/core/ethtool.c +9 −1
  27. net/core/rtnetlink.c +3 −0
  28. net/ipv4/fib_trie.c +2 −1
  29. net/ipv4/netfilter/arp_tables.c +6 −0
  30. net/ipv4/netfilter/ip_tables.c +6 −0
  31. net/ipv4/route.c +4 −0
  32. net/ipv4/tcp.c +7 −4
  33. net/ipv4/tcp_fastopen.c +4 −0
  34. net/ipv4/tcp_input.c +13 −6
  35. net/ipv4/tcp_minisocks.c +1 −1
  36. net/ipv6/ip6_fib.c +37 −2
  37. net/ipv6/ip6_output.c +3 −1
  38. net/ipv6/netfilter/ip6_tables.c +6 −0
  39. net/ipv6/route.c +9 −5
  40. net/ipv6/tcp_ipv6.c +1 −1
  41. net/ipv6/udp.c +3 −1
  42. net/mac80211/wep.c +4 −2
  43. net/netfilter/Kconfig +2 −0
  44. net/netfilter/ipvs/ip_vs_ctl.c +3 −0
  45. net/netfilter/nf_conntrack_proto_tcp.c +32 −3
  46. net/netfilter/nf_tables_api.c +2 −2
  47. net/netfilter/nfnetlink_log.c +10 −9
  48. net/netfilter/nfnetlink_queue_core.c +9 −9
  49. net/netlink/af_netlink.c +2 −1
  50. net/sched/cls_api.c +5 −0
  51. net/switchdev/switchdev.c +3 −3
Documentation/devicetree/bindings/net/cdns-emac.txt+2−1
@@ -3,7 +3,8 @@ · 2 unmodified lines
33 Required properties:
44 - compatible: Should be "cdns,[<chip>-]{emac}"
55 Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC.
6− or the generic form: "cdns,emac".
6+ Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC.
7+ Or the generic form: "cdns,emac".
78 - reg: Address and length of the register set for the device
89 - interrupts: Should contain macb interrupt
910 - phy-mode: see ethernet.txt file in the same directory.
arch/arm/boot/dts/zynq-7000.dtsi+2−2
@@ -193,7 +193,7 @@ · 192 unmodified lines
193193 };
194194
195195 gem0: ethernet@e000b000 {
196− compatible = "cdns,gem";
196+ compatible = "cdns,zynq-gem";
197197 reg = <0xe000b000 0x1000>;
198198 status = "disabled";
199199 interrupts = <0 22 4>;
@@ -204,7 +204,7 @@ · 4 unmodified lines
204204 };
205205
206206 gem1: ethernet@e000c000 {
207− compatible = "cdns,gem";
207+ compatible = "cdns,zynq-gem";
208208 reg = <0xe000c000 0x1000>;
209209 status = "disabled";
210210 interrupts = <0 45 4>;
drivers/bluetooth/ath3k.c+4−0
@@ -88,6 +88,7 @@ static const struct usb_device_id ath3k_table[] = { · 87 unmodified lines
8888 { USB_DEVICE(0x04CA, 0x3007) },
8989 { USB_DEVICE(0x04CA, 0x3008) },
9090 { USB_DEVICE(0x04CA, 0x300b) },
91+ { USB_DEVICE(0x04CA, 0x300f) },
9192 { USB_DEVICE(0x04CA, 0x3010) },
9293 { USB_DEVICE(0x0930, 0x0219) },
9394 { USB_DEVICE(0x0930, 0x0220) },
@@ -104,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = { · 10 unmodified lines
104105 { USB_DEVICE(0x0cf3, 0xe003) },
105106 { USB_DEVICE(0x0CF3, 0xE004) },
106107 { USB_DEVICE(0x0CF3, 0xE005) },
108+ { USB_DEVICE(0x0CF3, 0xE006) },
107109 { USB_DEVICE(0x13d3, 0x3362) },
108110 { USB_DEVICE(0x13d3, 0x3375) },
109111 { USB_DEVICE(0x13d3, 0x3393) },
@@ -143,6 +145,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 33 unmodified lines
143145 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
144146 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
145147 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
148+ { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 },
146149 { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
147150 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
148151 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
@@ -158,6 +161,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 9 unmodified lines
158161 { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 },
159162 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
160163 { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
164+ { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 },
161165 { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
162166 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
163167 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
drivers/bluetooth/btusb.c+3−0
@@ -186,6 +186,7 @@ static const struct usb_device_id blacklist_table[] = { · 185 unmodified lines
186186 { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 },
187187 { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 },
188188 { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 },
189+ { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 },
189190 { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 },
190191 { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 },
191192 { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 },
@@ -202,6 +203,7 @@ static const struct usb_device_id blacklist_table[] = { · 10 unmodified lines
202203 { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
203204 { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 },
204205 { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 },
206+ { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 },
205207 { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 },
206208 { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 },
207209 { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 },
@@ -218,6 +220,7 @@ static const struct usb_device_id blacklist_table[] = { · 10 unmodified lines
218220 { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 },
219221
220222 /* QCA ROME chipset */
223+ { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME },
221224 { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME },
222225 { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME },
223226
drivers/net/bonding/bond_options.c+1−1
@@ -624,7 +624,7 @@ int __bond_opt_set(struct bonding *bond, · 623 unmodified lines
624624 out:
625625 if (ret)
626626 bond_opt_error_interpret(bond, opt, ret, val);
627− else
627+ else if (bond->dev->reg_state == NETREG_REGISTERED)
628628 call_netdevice_notifiers(NETDEV_CHANGEINFODATA, bond->dev);
629629
630630 return ret;
drivers/net/ethernet/cadence/macb.c+18−0
@@ -350,6 +350,9 @@ static int macb_mii_probe(struct net_device *dev) · 349 unmodified lines
350350 else
351351 phydev->supported &= PHY_BASIC_FEATURES;
352352
353+ if (bp->caps & MACB_CAPS_NO_GIGABIT_HALF)
354+ phydev->supported &= ~SUPPORTED_1000baseT_Half;
355+
353356 phydev->advertising = phydev->supported;
354357
355358 bp->link = 0;
@@ -1037,6 +1040,12 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) · 681 unmodified lines
10371040 * add that if/when we get our hands on a full-blown MII PHY.
10381041 */
10391042
1043+ /* There is a hardware issue under heavy load where DMA can
1044+ * stop, this causes endless "used buffer descriptor read"
1045+ * interrupts but it can be cleared by re-enabling RX. See
1046+ * the at91 manual, section 41.3.1 or the Zynq manual
1047+ * section 16.7.4 for details.
1048+ */
10401049 if (status & MACB_BIT(RXUBR)) {
10411050 ctrl = macb_readl(bp, NCR);
10421051 macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE));
@@ -2693,6 +2702,14 @@ static const struct macb_config emac_config = { · 1650 unmodified lines
26932702 .init = at91ether_init,
26942703 };
26952704
2705+static const struct macb_config zynq_config = {
2706+ .caps = MACB_CAPS_SG_DISABLED | MACB_CAPS_GIGABIT_MODE_AVAILABLE |
2707+ MACB_CAPS_NO_GIGABIT_HALF,
2708+ .dma_burst_length = 16,
2709+ .clk_init = macb_clk_init,
2710+ .init = macb_init,
2711+};
2712+
26962713 static const struct of_device_id macb_dt_ids[] = {
26972714 { .compatible = "cdns,at32ap7000-macb" },
26982715 { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config },
@@ -2703,6 +2720,7 @@ static const struct of_device_id macb_dt_ids[] = { · 4 unmodified lines
27032720 { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config },
27042721 { .compatible = "cdns,at91rm9200-emac", .data = &emac_config },
27052722 { .compatible = "cdns,emac", .data = &emac_config },
2723+ { .compatible = "cdns,zynq-gem", .data = &zynq_config },
27062724 { /* sentinel */ }
27072725 };
27082726 MODULE_DEVICE_TABLE(of, macb_dt_ids);
drivers/net/ethernet/cadence/macb.h+1−0
@@ -393,6 +393,7 @@ · 392 unmodified lines
393393 #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001
394394 #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002
395395 #define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004
396+#define MACB_CAPS_NO_GIGABIT_HALF 0x00000008
396397 #define MACB_CAPS_FIFO_MODE 0x10000000
397398 #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000
398399 #define MACB_CAPS_SG_DISABLED 0x40000000
drivers/net/ethernet/mellanox/mlx4/resource_tracker.c+4−4
@@ -3187,7 +3187,7 @@ int mlx4_SW2HW_CQ_wrapper(struct mlx4_dev *dev, int slave, · 3186 unmodified lines
31873187 int cqn = vhcr->in_modifier;
31883188 struct mlx4_cq_context *cqc = inbox->buf;
31893189 int mtt_base = cq_get_mtt_addr(cqc) / dev->caps.mtt_entry_sz;
3190− struct res_cq *cq;
3190+ struct res_cq *cq = NULL;
31913191 struct res_mtt *mtt;
31923192
31933193 err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_HW, &cq);
@@ -3223,7 +3223,7 @@ int mlx4_HW2SW_CQ_wrapper(struct mlx4_dev *dev, int slave, · 29 unmodified lines
32233223 {
32243224 int err;
32253225 int cqn = vhcr->in_modifier;
3226− struct res_cq *cq;
3226+ struct res_cq *cq = NULL;
32273227
32283228 err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq);
32293229 if (err)
@@ -3362,7 +3362,7 @@ int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave, · 132 unmodified lines
33623362 int err;
33633363 int srqn = vhcr->in_modifier;
33643364 struct res_mtt *mtt;
3365− struct res_srq *srq;
3365+ struct res_srq *srq = NULL;
33663366 struct mlx4_srq_context *srqc = inbox->buf;
33673367 int mtt_base = srq_get_mtt_addr(srqc) / dev->caps.mtt_entry_sz;
33683368
@@ -3406,7 +3406,7 @@ int mlx4_HW2SW_SRQ_wrapper(struct mlx4_dev *dev, int slave, · 37 unmodified lines
34063406 {
34073407 int err;
34083408 int srqn = vhcr->in_modifier;
3409− struct res_srq *srq;
3409+ struct res_srq *srq = NULL;
34103410
34113411 err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq);
34123412 if (err)
drivers/net/ethernet/rocker/rocker.c+5−3
@@ -2921,10 +2921,11 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port, · 2920 unmodified lines
29212921 struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr);
29222922 int err = 0;
29232923
2924− if (!n)
2924+ if (!n) {
29252925 n = neigh_create(&arp_tbl, &ip_addr, dev);
2926− if (!n)
2927− return -ENOMEM;
2926+ if (IS_ERR(n))
2927+ return IS_ERR(n);
2928+ }
29282929
29292930 /* If the neigh is already resolved, then go ahead and
29302931 * install the entry, otherwise start the ARP process to
@@ -2936,6 +2937,7 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port, · 5 unmodified lines
29362937 else
29372938 neigh_event_send(n, NULL);
29382939
2940+ neigh_release(n);
29392941 return err;
29402942 }
29412943
drivers/net/phy/phy.c+19−15
@@ -742,6 +742,9 @@ EXPORT_SYMBOL(phy_stop); · 741 unmodified lines
742742 */
743743 void phy_start(struct phy_device *phydev)
744744 {
745+ bool do_resume = false;
746+ int err = 0;
747+
745748 mutex_lock(&phydev->lock);
746749
747750 switch (phydev->state) {
@@ -752,11 +755,22 @@ void phy_start(struct phy_device *phydev) · 4 unmodified lines
752755 phydev->state = PHY_UP;
753756 break;
754757 case PHY_HALTED:
758+ /* make sure interrupts are re-enabled for the PHY */
759+ err = phy_enable_interrupts(phydev);
760+ if (err < 0)
761+ break;
762+
755763 phydev->state = PHY_RESUMING;
764+ do_resume = true;
765+ break;
756766 default:
757767 break;
758768 }
759769 mutex_unlock(&phydev->lock);
770+
771+ /* if phy was suspended, bring the physical link up again */
772+ if (do_resume)
773+ phy_resume(phydev);
760774 }
761775 EXPORT_SYMBOL(phy_start);
762776
@@ -769,7 +783,7 @@ void phy_state_machine(struct work_struct *work) · 6 unmodified lines
769783 struct delayed_work *dwork = to_delayed_work(work);
770784 struct phy_device *phydev =
771785 container_of(dwork, struct phy_device, state_queue);
772− bool needs_aneg = false, do_suspend = false, do_resume = false;
786+ bool needs_aneg = false, do_suspend = false;
773787 int err = 0;
774788
775789 mutex_lock(&phydev->lock);
@@ -888,14 +902,6 @@ void phy_state_machine(struct work_struct *work) · 112 unmodified lines
888902 }
889903 break;
890904 case PHY_RESUMING:
891− err = phy_clear_interrupt(phydev);
892− if (err)
893− break;
894−
895− err = phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED);
896− if (err)
897− break;
898−
899905 if (AUTONEG_ENABLE == phydev->autoneg) {
900906 err = phy_aneg_done(phydev);
901907 if (err < 0)
@@ -933,7 +939,6 @@ void phy_state_machine(struct work_struct *work) · 31 unmodified lines
933939 }
934940 phydev->adjust_link(phydev->attached_dev);
935941 }
936− do_resume = true;
937942 break;
938943 }
939944
@@ -943,8 +948,6 @@ void phy_state_machine(struct work_struct *work) · 3 unmodified lines
943948 err = phy_start_aneg(phydev);
944949 else if (do_suspend)
945950 phy_suspend(phydev);
946− else if (do_resume)
947− phy_resume(phydev);
948951
949952 if (err < 0)
950953 phy_error(phydev);
@@ -1053,13 +1056,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) · 102 unmodified lines
10531056 {
10541057 /* According to 802.3az,the EEE is supported only in full duplex-mode.
10551058 * Also EEE feature is active when core is operating with MII, GMII
1056− * or RGMII. Internal PHYs are also allowed to proceed and should
1057− * return an error if they do not support EEE.
1059+ * or RGMII (all kinds). Internal PHYs are also allowed to proceed and
1060+ * should return an error if they do not support EEE.
10581061 */
10591062 if ((phydev->duplex == DUPLEX_FULL) &&
10601063 ((phydev->interface == PHY_INTERFACE_MODE_MII) ||
10611064 (phydev->interface == PHY_INTERFACE_MODE_GMII) ||
1062− (phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
1065+ (phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
1066+ phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID) ||
10631067 phy_is_internal(phydev))) {
10641068 int eee_lp, eee_cap, eee_adv;
10651069 u32 lp, cap, adv;
drivers/net/usb/cdc_ncm.c+1−1
@@ -1182,7 +1182,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) · 1181 unmodified lines
11821182 * payload data instead.
11831183 */
11841184 usbnet_set_skb_tx_stats(skb_out, n,
1185− ctx->tx_curr_frame_payload - skb_out->len);
1185+ (long)ctx->tx_curr_frame_payload - skb_out->len);
11861186
11871187 return skb_out;
11881188
drivers/net/vxlan.c+1−1
@@ -2961,7 +2961,7 @@ static void __net_exit vxlan_exit_net(struct net *net) · 2960 unmodified lines
29612961 * to the list by the previous loop.
29622962 */
29632963 if (!net_eq(dev_net(vxlan->dev), net))
2964− unregister_netdevice_queue(dev, &list);
2964+ unregister_netdevice_queue(vxlan->dev, &list);
29652965 }
29662966
29672967 unregister_netdevice_many(&list);
include/linux/rhashtable.h+19−0
@@ -17,6 +17,7 @@ · 16 unmodified lines
1717 #ifndef _LINUX_RHASHTABLE_H
1818 #define _LINUX_RHASHTABLE_H
1919
20+#include <linux/atomic.h>
2021 #include <linux/compiler.h>
2122 #include <linux/errno.h>
2223 #include <linux/jhash.h>
@@ -100,6 +101,7 @@ struct rhashtable; · 77 unmodified lines
100101 * @key_len: Length of key
101102 * @key_offset: Offset of key in struct to be hashed
102103 * @head_offset: Offset of rhash_head in struct to be hashed
104+ * @insecure_max_entries: Maximum number of entries (may be exceeded)
103105 * @max_size: Maximum size while expanding
104106 * @min_size: Minimum size while shrinking
105107 * @nulls_base: Base value to generate nulls marker
@@ -115,6 +117,7 @@ struct rhashtable_params { · 9 unmodified lines
115117 size_t key_len;
116118 size_t key_offset;
117119 size_t head_offset;
120+ unsigned int insecure_max_entries;
118121 unsigned int max_size;
119122 unsigned int min_size;
120123 u32 nulls_base;
@@ -286,6 +289,18 @@ static inline bool rht_grow_above_100(const struct rhashtable *ht, · 165 unmodified lines
286289 (!ht->p.max_size || tbl->size < ht->p.max_size);
287290 }
288291
292+/**
293+ * rht_grow_above_max - returns true if table is above maximum
294+ * @ht: hash table
295+ * @tbl: current table
296+ */
297+static inline bool rht_grow_above_max(const struct rhashtable *ht,
298+ const struct bucket_table *tbl)
299+{
300+ return ht->p.insecure_max_entries &&
301+ atomic_read(&ht->nelems) >= ht->p.insecure_max_entries;
302+}
303+
289304 /* The bucket lock is selected based on the hash and protects mutations
290305 * on a group of hash buckets.
291306 *
@@ -589,6 +604,10 @@ restart: · 297 unmodified lines
589604 goto out;
590605 }
591606
607+ err = -E2BIG;
608+ if (unlikely(rht_grow_above_max(ht, tbl)))
609+ goto out;
610+
592611 if (unlikely(rht_grow_above_100(ht, tbl))) {
593612 slow_path:
594613 spin_unlock_bh(lock);
include/linux/skbuff.h+1−0
@@ -176,6 +176,7 @@ struct nf_bridge_info { · 175 unmodified lines
176176 struct net_device *physindev;
177177 struct net_device *physoutdev;
178178 char neigh_header[8];
179+ __be32 ipv4_daddr;
179180 };
180181 #endif
181182
include/linux/tcp.h+2−0
@@ -158,6 +158,8 @@ struct tcp_sock { · 157 unmodified lines
158158 * sum(delta(snd_una)), or how many bytes
159159 * were acked.
160160 */
161+ struct u64_stats_sync syncp; /* protects 64bit vars (cf tcp_get_info()) */
162+
161163 u32 snd_una; /* First byte we want an ack for */
162164 u32 snd_sml; /* Last byte of the most recently transmitted small packet */
163165 u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
include/net/inet_connection_sock.h+3−2
@@ -129,9 +129,10 @@ struct inet_connection_sock { · 128 unmodified lines
129129
130130 u32 probe_timestamp;
131131 } icsk_mtup;
132− u32 icsk_ca_priv[16];
133132 u32 icsk_user_timeout;
134−#define ICSK_CA_PRIV_SIZE (16 * sizeof(u32))
133+
134+ u64 icsk_ca_priv[64 / sizeof(u64)];
135+#define ICSK_CA_PRIV_SIZE (8 * sizeof(u64))
135136 };
136137
137138 #define ICSK_TIME_RETRANS 1 /* Retransmit timer */
include/uapi/linux/netfilter/nf_conntrack_tcp.h+3−0
@@ -42,6 +42,9 @@ enum tcp_conntrack { · 41 unmodified lines
4242 /* The field td_maxack has been set */
4343 #define IP_CT_TCP_FLAG_MAXACK_SET 0x20
4444
45+/* Marks possibility for expected RFC5961 challenge ACK */
46+#define IP_CT_EXP_CHALLENGE_ACK 0x40
47+
4548 struct nf_ct_tcp_flags {
4649 __u8 flags;
4750 __u8 mask;
include/uapi/linux/rtnetlink.h+1−1
@@ -337,7 +337,7 @@ struct rtnexthop { · 336 unmodified lines
337337 #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */
338338 #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */
339339 #define RTNH_F_ONLINK 4 /* Gateway is forced on link */
340−#define RTNH_F_EXTERNAL 8 /* Route installed externally */
340+#define RTNH_F_OFFLOAD 8 /* offloaded route */
341341
342342 /* Macros to handle hexthops */
343343
lib/rhashtable.c+11−0
@@ -14,6 +14,7 @@ · 13 unmodified lines
1414 * published by the Free Software Foundation.
1515 */
1616
17+#include <linux/atomic.h>
1718 #include <linux/kernel.h>
1819 #include <linux/init.h>
1920 #include <linux/log2.h>
@@ -446,6 +447,10 @@ int rhashtable_insert_slow(struct rhashtable *ht, const void *key, · 426 unmodified lines
446447 if (key && rhashtable_lookup_fast(ht, key, ht->p))
447448 goto exit;
448449
450+ err = -E2BIG;
451+ if (unlikely(rht_grow_above_max(ht, tbl)))
452+ goto exit;
453+
449454 err = -EAGAIN;
450455 if (rhashtable_check_elasticity(ht, tbl, hash) ||
451456 rht_grow_above_100(ht, tbl))
@@ -738,6 +743,12 @@ int rhashtable_init(struct rhashtable *ht, · 286 unmodified lines
738743 if (params->max_size)
739744 ht->p.max_size = rounddown_pow_of_two(params->max_size);
740745
746+ if (params->insecure_max_entries)
747+ ht->p.insecure_max_entries =
748+ rounddown_pow_of_two(params->insecure_max_entries);
749+ else
750+ ht->p.insecure_max_entries = ht->p.max_size * 2;
751+
741752 ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE);
742753
743754 /* The maximum (not average) chain length grows with the
net/8021q/vlan.c+1−1
@@ -443,7 +443,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, · 442 unmodified lines
443443 case NETDEV_UP:
444444 /* Put all VLANs for this dev in the up state too. */
445445 vlan_group_for_each_dev(grp, i, vlandev) {
446− flgs = vlandev->flags;
446+ flgs = dev_get_flags(vlandev);
447447 if (flgs & IFF_UP)
448448 continue;
449449
net/bluetooth/hci_core.c+4−2
@@ -2854,9 +2854,11 @@ static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status, · 2853 unmodified lines
28542854 * state. If we were running both LE and BR/EDR inquiry
28552855 * simultaneously, and BR/EDR inquiry is already
28562856 * finished, stop discovery, otherwise BR/EDR inquiry
2857− * will stop discovery when finished.
2857+ * will stop discovery when finished. If we will resolve
2858+ * remote device name, do not change discovery state.
28582859 */
2859− if (!test_bit(HCI_INQUIRY, &hdev->flags))
2860+ if (!test_bit(HCI_INQUIRY, &hdev->flags) &&
2861+ hdev->discovery.state != DISCOVERY_RESOLVING)
28602862 hci_discovery_set_state(hdev,
28612863 DISCOVERY_STOPPED);
28622864 } else {
net/bridge/br_multicast.c+1−1
@@ -1072,7 +1072,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, · 1071 unmodified lines
10721072
10731073 err = br_ip6_multicast_add_group(br, port, &grec->grec_mca,
10741074 vid);
1075− if (!err)
1075+ if (err)
10761076 break;
10771077 }
10781078
net/bridge/br_netfilter.c+9−18
@@ -37,10 +37,6 @@ · 36 unmodified lines
3737 #include <net/route.h>
3838 #include <net/netfilter/br_netfilter.h>
3939
40−#if IS_ENABLED(CONFIG_NF_CONNTRACK)
41−#include <net/netfilter/nf_conntrack.h>
42−#endif
43−
4440 #include <asm/uaccess.h>
4541 #include "br_private.h"
4642 #ifdef CONFIG_SYSCTL
@@ -350,24 +346,15 @@ free_skb: · 303 unmodified lines
350346 return 0;
351347 }
352348
353−static bool dnat_took_place(const struct sk_buff *skb)
349+static bool daddr_was_changed(const struct sk_buff *skb,
350+ const struct nf_bridge_info *nf_bridge)
354351 {
355−#if IS_ENABLED(CONFIG_NF_CONNTRACK)
356− enum ip_conntrack_info ctinfo;
357− struct nf_conn *ct;
358−
359− ct = nf_ct_get(skb, &ctinfo);
360− if (!ct || nf_ct_is_untracked(ct))
361− return false;
362−
363− return test_bit(IPS_DST_NAT_BIT, &ct->status);
364−#else
365− return false;
366−#endif
352+ return ip_hdr(skb)->daddr != nf_bridge->ipv4_daddr;
367353 }
368354
369355 /* This requires some explaining. If DNAT has taken place,
370356 * we will need to fix up the destination Ethernet address.
357+ * This is also true when SNAT takes place (for the reply direction).
371358 *
372359 * There are two cases to consider:
373360 * 1. The packet was DNAT'ed to a device in the same bridge
@@ -421,7 +408,7 @@ static int br_nf_pre_routing_finish(struct sock *sk, struct sk_buff *skb) · 47 unmodified lines
421408 nf_bridge->pkt_otherhost = false;
422409 }
423410 nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING;
424− if (dnat_took_place(skb)) {
411+ if (daddr_was_changed(skb, nf_bridge)) {
425412 if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) {
426413 struct in_device *in_dev = __in_dev_get_rcu(dev);
427414
@@ -632,6 +619,7 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops, · 204 unmodified lines
632619 struct sk_buff *skb,
633620 const struct nf_hook_state *state)
634621 {
622+ struct nf_bridge_info *nf_bridge;
635623 struct net_bridge_port *p;
636624 struct net_bridge *br;
637625 __u32 len = nf_bridge_encap_header_len(skb);
@@ -669,6 +657,9 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops, · 31 unmodified lines
669657 if (!setup_pre_routing(skb))
670658 return NF_DROP;
671659
660+ nf_bridge = nf_bridge_info_get(skb);
661+ nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr;
662+
672663 skb->protocol = htons(ETH_P_IP);
673664
674665 NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->sk, skb,
net/bridge/br_stp_timer.c+2−0
@@ -97,7 +97,9 @@ static void br_forward_delay_timer_expired(unsigned long arg) · 96 unmodified lines
9797 netif_carrier_on(br->dev);
9898 }
9999 br_log_state(p);
100+ rcu_read_lock();
100101 br_ifinfo_notify(RTM_NEWLINK, p);
102+ rcu_read_unlock();
101103 spin_unlock(&br->lock);
102104 }
103105
net/bridge/netfilter/ebtables.c+4−0
@@ -1117,6 +1117,8 @@ static int do_replace(struct net *net, const void __user *user, · 1116 unmodified lines
11171117 return -ENOMEM;
11181118 if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter))
11191119 return -ENOMEM;
1120+ if (tmp.num_counters == 0)
1121+ return -EINVAL;
11201122
11211123 tmp.name[sizeof(tmp.name) - 1] = 0;
11221124
@@ -2159,6 +2161,8 @@ static int compat_copy_ebt_replace_from_user(struct ebt_replace *repl, · 1036 unmodified lines
21592161 return -ENOMEM;
21602162 if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter))
21612163 return -ENOMEM;
2164+ if (tmp.num_counters == 0)
2165+ return -EINVAL;
21622166
21632167 memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry));
21642168
net/core/ethtool.c+9−1
@@ -359,7 +359,15 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) · 358 unmodified lines
359359 int err;
360360 struct ethtool_cmd cmd;
361361
362− err = __ethtool_get_settings(dev, &cmd);
362+ if (!dev->ethtool_ops->get_settings)
363+ return -EOPNOTSUPP;
364+
365+ if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
366+ return -EFAULT;
367+
368+ cmd.cmd = ETHTOOL_GSET;
369+
370+ err = dev->ethtool_ops->get_settings(dev, &cmd);
363371 if (err < 0)
364372 return err;
365373
net/core/rtnetlink.c+3−0
@@ -2416,6 +2416,9 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change, · 2415 unmodified lines
24162416 {
24172417 struct sk_buff *skb;
24182418
2419+ if (dev->reg_state != NETREG_REGISTERED)
2420+ return;
2421+
24192422 skb = rtmsg_ifinfo_build_skb(type, dev, change, flags);
24202423 if (skb)
24212424 rtmsg_ifinfo_send(skb, dev, flags);
net/ipv4/fib_trie.c+2−1
@@ -1164,6 +1164,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) · 1163 unmodified lines
11641164 state = fa->fa_state;
11651165 new_fa->fa_state = state & ~FA_S_ACCESSED;
11661166 new_fa->fa_slen = fa->fa_slen;
1167+ new_fa->tb_id = tb->tb_id;
11671168
11681169 err = netdev_switch_fib_ipv4_add(key, plen, fi,
11691170 new_fa->fa_tos,
@@ -1764,7 +1765,7 @@ void fib_table_flush_external(struct fib_table *tb) · 594 unmodified lines
17641765 /* record local slen */
17651766 slen = fa->fa_slen;
17661767
1767− if (!fi || !(fi->fib_flags & RTNH_F_EXTERNAL))
1768+ if (!fi || !(fi->fib_flags & RTNH_F_OFFLOAD))
17681769 continue;
17691770
17701771 netdev_switch_fib_ipv4_del(n->key,
net/ipv4/netfilter/arp_tables.c+6−0
@@ -1075,6 +1075,9 @@ static int do_replace(struct net *net, const void __user *user, · 1074 unmodified lines
10751075 /* overflow check */
10761076 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
10771077 return -ENOMEM;
1078+ if (tmp.num_counters == 0)
1079+ return -EINVAL;
1080+
10781081 tmp.name[sizeof(tmp.name)-1] = 0;
10791082
10801083 newinfo = xt_alloc_table_info(tmp.size);
@@ -1499,6 +1502,9 @@ static int compat_do_replace(struct net *net, void __user *user, · 418 unmodified lines
14991502 return -ENOMEM;
15001503 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
15011504 return -ENOMEM;
1505+ if (tmp.num_counters == 0)
1506+ return -EINVAL;
1507+
15021508 tmp.name[sizeof(tmp.name)-1] = 0;
15031509
15041510 newinfo = xt_alloc_table_info(tmp.size);
net/ipv4/netfilter/ip_tables.c+6−0
@@ -1262,6 +1262,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) · 1261 unmodified lines
12621262 /* overflow check */
12631263 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
12641264 return -ENOMEM;
1265+ if (tmp.num_counters == 0)
1266+ return -EINVAL;
1267+
12651268 tmp.name[sizeof(tmp.name)-1] = 0;
12661269
12671270 newinfo = xt_alloc_table_info(tmp.size);
@@ -1809,6 +1812,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) · 541 unmodified lines
18091812 return -ENOMEM;
18101813 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
18111814 return -ENOMEM;
1815+ if (tmp.num_counters == 0)
1816+ return -EINVAL;
1817+
18121818 tmp.name[sizeof(tmp.name)-1] = 0;
18131819
18141820 newinfo = xt_alloc_table_info(tmp.size);
net/ipv4/route.c+4−0
@@ -902,6 +902,10 @@ static int ip_error(struct sk_buff *skb) · 901 unmodified lines
902902 bool send;
903903 int code;
904904
905+ /* IP on this device is disabled. */
906+ if (!in_dev)
907+ goto out;
908+
905909 net = dev_net(rt->dst.dev);
906910 if (!IN_DEV_FORWARD(in_dev)) {
907911 switch (rt->dst.error) {
net/ipv4/tcp.c+7−4
@@ -402,6 +402,7 @@ void tcp_init_sock(struct sock *sk) · 401 unmodified lines
402402 tp->snd_ssthresh = TCP_INFINITE_SSTHRESH;
403403 tp->snd_cwnd_clamp = ~0;
404404 tp->mss_cache = TCP_MSS_DEFAULT;
405+ u64_stats_init(&tp->syncp);
405406
406407 tp->reordering = sysctl_tcp_reordering;
407408 tcp_enable_early_retrans(tp);
@@ -2598,6 +2599,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 2190 unmodified lines
25982599 const struct tcp_sock *tp = tcp_sk(sk);
25992600 const struct inet_connection_sock *icsk = inet_csk(sk);
26002601 u32 now = tcp_time_stamp;
2602+ unsigned int start;
26012603 u32 rate;
26022604
26032605 memset(info, 0, sizeof(*info));
@@ -2665,10 +2667,11 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 61 unmodified lines
26652667 rate = READ_ONCE(sk->sk_max_pacing_rate);
26662668 info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL;
26672669
2668− spin_lock_bh(&sk->sk_lock.slock);
2669− info->tcpi_bytes_acked = tp->bytes_acked;
2670− info->tcpi_bytes_received = tp->bytes_received;
2671− spin_unlock_bh(&sk->sk_lock.slock);
2670+ do {
2671+ start = u64_stats_fetch_begin_irq(&tp->syncp);
2672+ info->tcpi_bytes_acked = tp->bytes_acked;
2673+ info->tcpi_bytes_received = tp->bytes_received;
2674+ } while (u64_stats_fetch_retry_irq(&tp->syncp, start));
26722675 }
26732676 EXPORT_SYMBOL_GPL(tcp_get_info);
26742677
net/ipv4/tcp_fastopen.c+4−0
@@ -206,6 +206,10 @@ static bool tcp_fastopen_create_child(struct sock *sk, · 205 unmodified lines
206206 skb_set_owner_r(skb2, child);
207207 __skb_queue_tail(&child->sk_receive_queue, skb2);
208208 tp->syn_data_acked = 1;
209+
210+ /* u64_stats_update_begin(&tp->syncp) not needed here,
211+ * as we certainly are not changing upper 32bit value (0)
212+ */
209213 tp->bytes_received = end_seq - TCP_SKB_CB(skb)->seq - 1;
210214 } else {
211215 end_seq = TCP_SKB_CB(skb)->seq + 1;
net/ipv4/tcp_input.c+13−6
@@ -2698,16 +2698,21 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) · 2697 unmodified lines
26982698 struct tcp_sock *tp = tcp_sk(sk);
26992699 bool recovered = !before(tp->snd_una, tp->high_seq);
27002700
2701+ if ((flag & FLAG_SND_UNA_ADVANCED) &&
2702+ tcp_try_undo_loss(sk, false))
2703+ return;
2704+
27012705 if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */
27022706 /* Step 3.b. A timeout is spurious if not all data are
27032707 * lost, i.e., never-retransmitted data are (s)acked.
27042708 */
2705− if (tcp_try_undo_loss(sk, flag & FLAG_ORIG_SACK_ACKED))
2709+ if ((flag & FLAG_ORIG_SACK_ACKED) &&
2710+ tcp_try_undo_loss(sk, true))
27062711 return;
27072712
2708− if (after(tp->snd_nxt, tp->high_seq) &&
2709− (flag & FLAG_DATA_SACKED || is_dupack)) {
2710− tp->frto = 0; /* Loss was real: 2nd part of step 3.a */
2713+ if (after(tp->snd_nxt, tp->high_seq)) {
2714+ if (flag & FLAG_DATA_SACKED || is_dupack)
2715+ tp->frto = 0; /* Step 3.a. loss was real */
27112716 } else if (flag & FLAG_SND_UNA_ADVANCED && !recovered) {
27122717 tp->high_seq = tp->snd_nxt;
27132718 __tcp_push_pending_frames(sk, tcp_current_mss(sk),
@@ -2732,8 +2737,6 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) · 18 unmodified lines
27322737 else if (flag & FLAG_SND_UNA_ADVANCED)
27332738 tcp_reset_reno_sack(tp);
27342739 }
2735− if (tcp_try_undo_loss(sk, false))
2736− return;
27372740 tcp_xmit_retransmit_queue(sk);
27382741 }
27392742
@@ -3283,7 +3286,9 @@ static void tcp_snd_una_update(struct tcp_sock *tp, u32 ack) · 543 unmodified lines
32833286 {
32843287 u32 delta = ack - tp->snd_una;
32853288
3289+ u64_stats_update_begin(&tp->syncp);
32863290 tp->bytes_acked += delta;
3291+ u64_stats_update_end(&tp->syncp);
32873292 tp->snd_una = ack;
32883293 }
32893294
@@ -3292,7 +3297,9 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) · 2 unmodified lines
32923297 {
32933298 u32 delta = seq - tp->rcv_nxt;
32943299
3300+ u64_stats_update_begin(&tp->syncp);
32953301 tp->bytes_received += delta;
3302+ u64_stats_update_end(&tp->syncp);
32963303 tp->rcv_nxt = seq;
32973304 }
32983305
net/ipv4/tcp_minisocks.c+1−1
@@ -300,7 +300,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) · 299 unmodified lines
300300 tw->tw_v6_daddr = sk->sk_v6_daddr;
301301 tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
302302 tw->tw_tclass = np->tclass;
303− tw->tw_flowlabel = np->flow_label >> 12;
303+ tw->tw_flowlabel = be32_to_cpu(np->flow_label & IPV6_FLOWLABEL_MASK);
304304 tw->tw_ipv6only = sk->sk_ipv6only;
305305 }
306306 #endif
net/ipv6/ip6_fib.c+37−2
@@ -693,6 +693,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, · 692 unmodified lines
693693 {
694694 struct rt6_info *iter = NULL;
695695 struct rt6_info **ins;
696+ struct rt6_info **fallback_ins = NULL;
696697 int replace = (info->nlh &&
697698 (info->nlh->nlmsg_flags & NLM_F_REPLACE));
698699 int add = (!info->nlh ||
@@ -716,8 +717,13 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, · 17 unmodified lines
716717 (info->nlh->nlmsg_flags & NLM_F_EXCL))
717718 return -EEXIST;
718719 if (replace) {
719− found++;
720− break;
720+ if (rt_can_ecmp == rt6_qualify_for_ecmp(iter)) {
721+ found++;
722+ break;
723+ }
724+ if (rt_can_ecmp)
725+ fallback_ins = fallback_ins ?: ins;
726+ goto next_iter;
721727 }
722728
723729 if (iter->dst.dev == rt->dst.dev &&
@@ -753,9 +759,17 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, · 29 unmodified lines
753759 if (iter->rt6i_metric > rt->rt6i_metric)
754760 break;
755761
762+next_iter:
756763 ins = &iter->dst.rt6_next;
757764 }
758765
766+ if (fallback_ins && !found) {
767+ /* No ECMP-able route found, replace first non-ECMP one */
768+ ins = fallback_ins;
769+ iter = *ins;
770+ found++;
771+ }
772+
759773 /* Reset round-robin state, if necessary */
760774 if (ins == &fn->leaf)
761775 fn->rr_ptr = NULL;
@@ -815,6 +829,8 @@ add: · 53 unmodified lines
815829 }
816830
817831 } else {
832+ int nsiblings;
833+
818834 if (!found) {
819835 if (add)
820836 goto add;
@@ -835,8 +851,27 @@ add: · 14 unmodified lines
835851 info->nl_net->ipv6.rt6_stats->fib_route_nodes++;
836852 fn->fn_flags |= RTN_RTINFO;
837853 }
854+ nsiblings = iter->rt6i_nsiblings;
838855 fib6_purge_rt(iter, fn, info->nl_net);
839856 rt6_release(iter);
857+
858+ if (nsiblings) {
859+ /* Replacing an ECMP route, remove all siblings */
860+ ins = &rt->dst.rt6_next;
861+ iter = *ins;
862+ while (iter) {
863+ if (rt6_qualify_for_ecmp(iter)) {
864+ *ins = iter->dst.rt6_next;
865+ fib6_purge_rt(iter, fn, info->nl_net);
866+ rt6_release(iter);
867+ nsiblings--;
868+ } else {
869+ ins = &iter->dst.rt6_next;
870+ }
871+ iter = *ins;
872+ }
873+ WARN_ON(nsiblings != 0);
874+ }
840875 }
841876
842877 return 0;
net/ipv6/ip6_output.c+3−1
@@ -1300,8 +1300,10 @@ emsgsize: · 1299 unmodified lines
13001300
13011301 /* If this is the first and only packet and device
13021302 * supports checksum offloading, let's use it.
1303+ * Use transhdrlen, same as IPv4, because partial
1304+ * sums only work when transhdrlen is set.
13031305 */
1304− if (!skb && sk->sk_protocol == IPPROTO_UDP &&
1306+ if (transhdrlen && sk->sk_protocol == IPPROTO_UDP &&
13051307 length + fragheaderlen < mtu &&
13061308 rt->dst.dev->features & NETIF_F_V6_CSUM &&
13071309 !exthdrlen)
net/ipv6/netfilter/ip6_tables.c+6−0
@@ -1275,6 +1275,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) · 1274 unmodified lines
12751275 /* overflow check */
12761276 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
12771277 return -ENOMEM;
1278+ if (tmp.num_counters == 0)
1279+ return -EINVAL;
1280+
12781281 tmp.name[sizeof(tmp.name)-1] = 0;
12791282
12801283 newinfo = xt_alloc_table_info(tmp.size);
@@ -1822,6 +1825,9 @@ compat_do_replace(struct net *net, void __user *user, unsigned int len) · 541 unmodified lines
18221825 return -ENOMEM;
18231826 if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters))
18241827 return -ENOMEM;
1828+ if (tmp.num_counters == 0)
1829+ return -EINVAL;
1830+
18251831 tmp.name[sizeof(tmp.name)-1] = 0;
18261832
18271833 newinfo = xt_alloc_table_info(tmp.size);
net/ipv6/route.c+9−5
@@ -2504,9 +2504,9 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add) · 2503 unmodified lines
25042504 int attrlen;
25052505 int err = 0, last_err = 0;
25062506
2507+ remaining = cfg->fc_mp_len;
25072508 beginning:
25082509 rtnh = (struct rtnexthop *)cfg->fc_mp;
2509− remaining = cfg->fc_mp_len;
25102510
25112511 /* Parse a Multipath Entry */
25122512 while (rtnh_ok(rtnh, remaining)) {
@@ -2536,15 +2536,19 @@ beginning: · 23 unmodified lines
25362536 * next hops that have been already added.
25372537 */
25382538 add = 0;
2539+ remaining = cfg->fc_mp_len - remaining;
25392540 goto beginning;
25402541 }
25412542 }
25422543 /* Because each route is added like a single route we remove
2543− * this flag after the first nexthop (if there is a collision,
2544− * we have already fail to add the first nexthop:
2545− * fib6_add_rt2node() has reject it).
2544+ * these flags after the first nexthop: if there is a collision,
2545+ * we have already failed to add the first nexthop:
2546+ * fib6_add_rt2node() has rejected it; when replacing, old
2547+ * nexthops have been replaced by first new, the rest should
2548+ * be added to it.
25462549 */
2547− cfg->fc_nlinfo.nlh->nlmsg_flags &= ~NLM_F_EXCL;
2550+ cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
2551+ NLM_F_REPLACE);
25482552 rtnh = rtnh_next(rtnh, &remaining);
25492553 }
25502554
net/ipv6/tcp_ipv6.c+1−1
@@ -914,7 +914,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) · 913 unmodified lines
914914 tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale,
915915 tcp_time_stamp + tcptw->tw_ts_offset,
916916 tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw),
917− tw->tw_tclass, (tw->tw_flowlabel << 12));
917+ tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel));
918918
919919 inet_twsk_put(tw);
920920 }
net/ipv6/udp.c+3−1
@@ -731,7 +731,9 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk, · 730 unmodified lines
731731 (inet->inet_dport && inet->inet_dport != rmt_port) ||
732732 (!ipv6_addr_any(&sk->sk_v6_daddr) &&
733733 !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) ||
734− (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
734+ (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) ||
735+ (!ipv6_addr_any(&sk->sk_v6_rcv_saddr) &&
736+ !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr)))
735737 return false;
736738 if (!inet6_mc_check(sk, loc_addr, rmt_addr))
737739 return false;
net/mac80211/wep.c+4−2
@@ -98,8 +98,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, · 97 unmodified lines
9898
9999 hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
100100
101− if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN ||
102− skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
101+ if (WARN_ON(skb_headroom(skb) < IEEE80211_WEP_IV_LEN))
103102 return NULL;
104103
105104 hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -167,6 +166,9 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, · 61 unmodified lines
167166 size_t len;
168167 u8 rc4key[3 + WLAN_KEY_LEN_WEP104];
169168
169+ if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN))
170+ return -1;
171+
170172 iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx);
171173 if (!iv)
172174 return -1;
net/netfilter/Kconfig+2−0
@@ -863,6 +863,7 @@ config NETFILTER_XT_TARGET_TPROXY · 862 unmodified lines
863863 depends on NETFILTER_XTABLES
864864 depends on NETFILTER_ADVANCED
865865 depends on (IPV6 || IPV6=n)
866+ depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n)
866867 depends on IP_NF_MANGLE
867868 select NF_DEFRAG_IPV4
868869 select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES
@@ -1356,6 +1357,7 @@ config NETFILTER_XT_MATCH_SOCKET · 487 unmodified lines
13561357 depends on NETFILTER_ADVANCED
13571358 depends on !NF_CONNTRACK || NF_CONNTRACK
13581359 depends on (IPV6 || IPV6=n)
1360+ depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n)
13591361 select NF_DEFRAG_IPV4
13601362 select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES
13611363 help
net/netfilter/ipvs/ip_vs_ctl.c+3−0
@@ -3823,6 +3823,9 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) · 3822 unmodified lines
38233823 cancel_work_sync(&ipvs->defense_work.work);
38243824 unregister_net_sysctl_table(ipvs->sysctl_hdr);
38253825 ip_vs_stop_estimator(net, &ipvs->tot_stats);
3826+
3827+ if (!net_eq(net, &init_net))
3828+ kfree(ipvs->sysctl_tbl);
38263829 }
38273830
38283831 #else
net/netfilter/nf_conntrack_proto_tcp.c+32−3
@@ -202,7 +202,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { · 201 unmodified lines
202202 * sES -> sES :-)
203203 * sFW -> sCW Normal close request answered by ACK.
204204 * sCW -> sCW
205− * sLA -> sTW Last ACK detected.
205+ * sLA -> sTW Last ACK detected (RFC5961 challenged)
206206 * sTW -> sTW Retransmitted last ACK. Remain in the same state.
207207 * sCL -> sCL
208208 */
@@ -261,7 +261,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { · 52 unmodified lines
261261 * sES -> sES :-)
262262 * sFW -> sCW Normal close request answered by ACK.
263263 * sCW -> sCW
264− * sLA -> sTW Last ACK detected.
264+ * sLA -> sTW Last ACK detected (RFC5961 challenged)
265265 * sTW -> sTW Retransmitted last ACK.
266266 * sCL -> sCL
267267 */
@@ -906,6 +906,7 @@ static int tcp_packet(struct nf_conn *ct, · 638 unmodified lines
906906 1 : ct->proto.tcp.last_win;
907907 ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale =
908908 ct->proto.tcp.last_wscale;
909+ ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK;
909910 ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags =
910911 ct->proto.tcp.last_flags;
911912 memset(&ct->proto.tcp.seen[dir], 0,
@@ -923,7 +924,9 @@ static int tcp_packet(struct nf_conn *ct, · 11 unmodified lines
923924 * may be in sync but we are not. In that case, we annotate
924925 * the TCP options and let the packet go through. If it is a
925926 * valid SYN packet, the server will reply with a SYN/ACK, and
926− * then we'll get in sync. Otherwise, the server ignores it. */
927+ * then we'll get in sync. Otherwise, the server potentially
928+ * responds with a challenge ACK if implementing RFC5961.
929+ */
927930 if (index == TCP_SYN_SET && dir == IP_CT_DIR_ORIGINAL) {
928931 struct ip_ct_tcp_state seen = {};
929932
@@ -939,6 +942,13 @@ static int tcp_packet(struct nf_conn *ct, · 9 unmodified lines
939942 ct->proto.tcp.last_flags |=
940943 IP_CT_TCP_FLAG_SACK_PERM;
941944 }
945+ /* Mark the potential for RFC5961 challenge ACK,
946+ * this pose a special problem for LAST_ACK state
947+ * as ACK is intrepretated as ACKing last FIN.
948+ */
949+ if (old_state == TCP_CONNTRACK_LAST_ACK)
950+ ct->proto.tcp.last_flags |=
951+ IP_CT_EXP_CHALLENGE_ACK;
942952 }
943953 spin_unlock_bh(&ct->lock);
944954 if (LOG_INVALID(net, IPPROTO_TCP))
@@ -970,6 +980,25 @@ static int tcp_packet(struct nf_conn *ct, · 25 unmodified lines
970980 nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL,
971981 "nf_ct_tcp: invalid state ");
972982 return -NF_ACCEPT;
983+ case TCP_CONNTRACK_TIME_WAIT:
984+ /* RFC5961 compliance cause stack to send "challenge-ACK"
985+ * e.g. in response to spurious SYNs. Conntrack MUST
986+ * not believe this ACK is acking last FIN.
987+ */
988+ if (old_state == TCP_CONNTRACK_LAST_ACK &&
989+ index == TCP_ACK_SET &&
990+ ct->proto.tcp.last_dir != dir &&
991+ ct->proto.tcp.last_index == TCP_SYN_SET &&
992+ (ct->proto.tcp.last_flags & IP_CT_EXP_CHALLENGE_ACK)) {
993+ /* Detected RFC5961 challenge ACK */
994+ ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK;
995+ spin_unlock_bh(&ct->lock);
996+ if (LOG_INVALID(net, IPPROTO_TCP))
997+ nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL,
998+ "nf_ct_tcp: challenge-ACK ignored ");
999+ return NF_ACCEPT; /* Don't change state */
1000+ }
1001+ break;
9731002 case TCP_CONNTRACK_CLOSE:
9741003 if (index == TCP_RST_SET
9751004 && (ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_MAXACK_SET)
net/netfilter/nf_tables_api.c+2−2
@@ -4472,9 +4472,9 @@ EXPORT_SYMBOL_GPL(nft_data_init); · 4471 unmodified lines
44724472 */
44734473 void nft_data_uninit(const struct nft_data *data, enum nft_data_types type)
44744474 {
4475− switch (type) {
4476− case NFT_DATA_VALUE:
4475+ if (type < NFT_DATA_VERDICT)
44774476 return;
4477+ switch (type) {
44784478 case NFT_DATA_VERDICT:
44794479 return nft_verdict_uninit(data);
44804480 default:
net/netfilter/nfnetlink_log.c+10−9
@@ -1073,7 +1073,13 @@ static struct pernet_operations nfnl_log_net_ops = { · 1072 unmodified lines
10731073
10741074 static int __init nfnetlink_log_init(void)
10751075 {
1076− int status = -ENOMEM;
1076+ int status;
1077+
1078+ status = register_pernet_subsys(&nfnl_log_net_ops);
1079+ if (status < 0) {
1080+ pr_err("failed to register pernet ops\n");
1081+ goto out;
1082+ }
10771083
10781084 netlink_register_notifier(&nfulnl_rtnl_notifier);
10791085 status = nfnetlink_subsys_register(&nfulnl_subsys);
@@ -1088,28 +1094,23 @@ static int __init nfnetlink_log_init(void) · 8 unmodified lines
10881094 goto cleanup_subsys;
10891095 }
10901096
1091− status = register_pernet_subsys(&nfnl_log_net_ops);
1092− if (status < 0) {
1093− pr_err("failed to register pernet ops\n");
1094− goto cleanup_logger;
1095− }
10961097 return status;
10971098
1098−cleanup_logger:
1099− nf_log_unregister(&nfulnl_logger);
11001099 cleanup_subsys:
11011100 nfnetlink_subsys_unregister(&nfulnl_subsys);
11021101 cleanup_netlink_notifier:
11031102 netlink_unregister_notifier(&nfulnl_rtnl_notifier);
1103+ unregister_pernet_subsys(&nfnl_log_net_ops);
1104+out:
11041105 return status;
11051106 }
11061107
11071108 static void __exit nfnetlink_log_fini(void)
11081109 {
1109− unregister_pernet_subsys(&nfnl_log_net_ops);
11101110 nf_log_unregister(&nfulnl_logger);
11111111 nfnetlink_subsys_unregister(&nfulnl_subsys);
11121112 netlink_unregister_notifier(&nfulnl_rtnl_notifier);
1113+ unregister_pernet_subsys(&nfnl_log_net_ops);
11131114 }
11141115
11151116 MODULE_DESCRIPTION("netfilter userspace logging");
net/netfilter/nfnetlink_queue_core.c+9−9
@@ -1317,7 +1317,13 @@ static struct pernet_operations nfnl_queue_net_ops = { · 1316 unmodified lines
13171317
13181318 static int __init nfnetlink_queue_init(void)
13191319 {
1320− int status = -ENOMEM;
1320+ int status;
1321+
1322+ status = register_pernet_subsys(&nfnl_queue_net_ops);
1323+ if (status < 0) {
1324+ pr_err("nf_queue: failed to register pernet ops\n");
1325+ goto out;
1326+ }
13211327
13221328 netlink_register_notifier(&nfqnl_rtnl_notifier);
13231329 status = nfnetlink_subsys_register(&nfqnl_subsys);
@@ -1326,19 +1332,13 @@ static int __init nfnetlink_queue_init(void) · 2 unmodified lines
13261332 goto cleanup_netlink_notifier;
13271333 }
13281334
1329− status = register_pernet_subsys(&nfnl_queue_net_ops);
1330− if (status < 0) {
1331− pr_err("nf_queue: failed to register pernet ops\n");
1332− goto cleanup_subsys;
1333− }
13341335 register_netdevice_notifier(&nfqnl_dev_notifier);
13351336 nf_register_queue_handler(&nfqh);
13361337 return status;
13371338
1338−cleanup_subsys:
1339− nfnetlink_subsys_unregister(&nfqnl_subsys);
13401339 cleanup_netlink_notifier:
13411340 netlink_unregister_notifier(&nfqnl_rtnl_notifier);
1341+out:
13421342 return status;
13431343 }
13441344
@@ -1346,9 +1346,9 @@ static void __exit nfnetlink_queue_fini(void) · 1 unmodified line
13461346 {
13471347 nf_unregister_queue_handler();
13481348 unregister_netdevice_notifier(&nfqnl_dev_notifier);
1349− unregister_pernet_subsys(&nfnl_queue_net_ops);
13501349 nfnetlink_subsys_unregister(&nfqnl_subsys);
13511350 netlink_unregister_notifier(&nfqnl_rtnl_notifier);
1351+ unregister_pernet_subsys(&nfnl_queue_net_ops);
13521352
13531353 rcu_barrier(); /* Wait for completion of call_rcu()'s */
13541354 }
net/netlink/af_netlink.c+2−1
@@ -89,7 +89,7 @@ static inline int netlink_is_kernel(struct sock *sk) · 88 unmodified lines
8989 return nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET;
9090 }
9191
92−struct netlink_table *nl_table;
92+struct netlink_table *nl_table __read_mostly;
9393 EXPORT_SYMBOL_GPL(nl_table);
9494
9595 static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait);
@@ -1081,6 +1081,7 @@ static int netlink_insert(struct sock *sk, u32 portid) · 985 unmodified lines
10811081 if (err) {
10821082 if (err == -EEXIST)
10831083 err = -EADDRINUSE;
1084+ nlk_sk(sk)->portid = 0;
10841085 sock_put(sk);
10851086 }
10861087
net/sched/cls_api.c+5−0
@@ -81,6 +81,11 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) · 80 unmodified lines
8181 struct tcf_proto_ops *t;
8282 int rc = -ENOENT;
8383
84+ /* Wait for outstanding call_rcu()s, if any, from a
85+ * tcf_proto_ops's destroy() handler.
86+ */
87+ rcu_barrier();
88+
8489 write_lock(&cls_mod_lock);
8590 list_for_each_entry(t, &tcf_proto_base, head) {
8691 if (t == ops) {
net/switchdev/switchdev.c+3−3
@@ -338,7 +338,7 @@ int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, · 337 unmodified lines
338338 fi, tos, type, nlflags,
339339 tb_id);
340340 if (!err)
341− fi->fib_flags |= RTNH_F_EXTERNAL;
341+ fi->fib_flags |= RTNH_F_OFFLOAD;
342342 }
343343
344344 return err;
@@ -364,7 +364,7 @@ int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, · 19 unmodified lines
364364 const struct swdev_ops *ops;
365365 int err = 0;
366366
367− if (!(fi->fib_flags & RTNH_F_EXTERNAL))
367+ if (!(fi->fib_flags & RTNH_F_OFFLOAD))
368368 return 0;
369369
370370 dev = netdev_switch_get_dev_by_nhs(fi);
@@ -376,7 +376,7 @@ int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, · 5 unmodified lines
376376 err = ops->swdev_fib_ipv4_del(dev, htonl(dst), dst_len,
377377 fi, tos, type, tb_id);
378378 if (!err)
379− fi->fib_flags &= ~RTNH_F_EXTERNAL;
379+ fi->fib_flags &= ~RTNH_F_OFFLOAD;
380380 }
381381
382382 return err;