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 ...
Unified · Split
| @@ -3,7 +3,8 @@ · 2 unmodified lines | ||
| 3 | 3 | Required properties: |
| 4 | 4 | - compatible: Should be "cdns,[<chip>-]{emac}" |
| 5 | 5 | 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". | |
| 7 | 8 | - reg: Address and length of the register set for the device |
| 8 | 9 | - interrupts: Should contain macb interrupt |
| 9 | 10 | - phy-mode: see ethernet.txt file in the same directory. |
| @@ -193,7 +193,7 @@ · 192 unmodified lines | ||
| 193 | 193 | }; |
| 194 | 194 | |
| 195 | 195 | gem0: ethernet@e000b000 { |
| 196 | − compatible = "cdns,gem"; | |
| 196 | + compatible = "cdns,zynq-gem"; | |
| 197 | 197 | reg = <0xe000b000 0x1000>; |
| 198 | 198 | status = "disabled"; |
| 199 | 199 | interrupts = <0 22 4>; |
| @@ -204,7 +204,7 @@ · 4 unmodified lines | ||
| 204 | 204 | }; |
| 205 | 205 | |
| 206 | 206 | gem1: ethernet@e000c000 { |
| 207 | − compatible = "cdns,gem"; | |
| 207 | + compatible = "cdns,zynq-gem"; | |
| 208 | 208 | reg = <0xe000c000 0x1000>; |
| 209 | 209 | status = "disabled"; |
| 210 | 210 | interrupts = <0 45 4>; |
| @@ -88,6 +88,7 @@ static const struct usb_device_id ath3k_table[] = { · 87 unmodified lines | ||
| 88 | 88 | { USB_DEVICE(0x04CA, 0x3007) }, |
| 89 | 89 | { USB_DEVICE(0x04CA, 0x3008) }, |
| 90 | 90 | { USB_DEVICE(0x04CA, 0x300b) }, |
| 91 | + { USB_DEVICE(0x04CA, 0x300f) }, | |
| 91 | 92 | { USB_DEVICE(0x04CA, 0x3010) }, |
| 92 | 93 | { USB_DEVICE(0x0930, 0x0219) }, |
| 93 | 94 | { USB_DEVICE(0x0930, 0x0220) }, |
| @@ -104,6 +105,7 @@ static const struct usb_device_id ath3k_table[] = { · 10 unmodified lines | ||
| 104 | 105 | { USB_DEVICE(0x0cf3, 0xe003) }, |
| 105 | 106 | { USB_DEVICE(0x0CF3, 0xE004) }, |
| 106 | 107 | { USB_DEVICE(0x0CF3, 0xE005) }, |
| 108 | + { USB_DEVICE(0x0CF3, 0xE006) }, | |
| 107 | 109 | { USB_DEVICE(0x13d3, 0x3362) }, |
| 108 | 110 | { USB_DEVICE(0x13d3, 0x3375) }, |
| 109 | 111 | { USB_DEVICE(0x13d3, 0x3393) }, |
| @@ -143,6 +145,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 33 unmodified lines | ||
| 143 | 145 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
| 144 | 146 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
| 145 | 147 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
| 148 | + { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, | |
| 146 | 149 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
| 147 | 150 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
| 148 | 151 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
| @@ -158,6 +161,7 @@ static const struct usb_device_id ath3k_blist_tbl[] = { · 9 unmodified lines | ||
| 158 | 161 | { USB_DEVICE(0x0CF3, 0x817a), .driver_info = BTUSB_ATH3012 }, |
| 159 | 162 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
| 160 | 163 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
| 164 | + { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, | |
| 161 | 165 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
| 162 | 166 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
| 163 | 167 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| @@ -186,6 +186,7 @@ static const struct usb_device_id blacklist_table[] = { · 185 unmodified lines | ||
| 186 | 186 | { USB_DEVICE(0x04ca, 0x3007), .driver_info = BTUSB_ATH3012 }, |
| 187 | 187 | { USB_DEVICE(0x04ca, 0x3008), .driver_info = BTUSB_ATH3012 }, |
| 188 | 188 | { USB_DEVICE(0x04ca, 0x300b), .driver_info = BTUSB_ATH3012 }, |
| 189 | + { USB_DEVICE(0x04ca, 0x300f), .driver_info = BTUSB_ATH3012 }, | |
| 189 | 190 | { USB_DEVICE(0x04ca, 0x3010), .driver_info = BTUSB_ATH3012 }, |
| 190 | 191 | { USB_DEVICE(0x0930, 0x0219), .driver_info = BTUSB_ATH3012 }, |
| 191 | 192 | { USB_DEVICE(0x0930, 0x0220), .driver_info = BTUSB_ATH3012 }, |
| @@ -202,6 +203,7 @@ static const struct usb_device_id blacklist_table[] = { · 10 unmodified lines | ||
| 202 | 203 | { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 }, |
| 203 | 204 | { USB_DEVICE(0x0cf3, 0xe004), .driver_info = BTUSB_ATH3012 }, |
| 204 | 205 | { USB_DEVICE(0x0cf3, 0xe005), .driver_info = BTUSB_ATH3012 }, |
| 206 | + { USB_DEVICE(0x0cf3, 0xe006), .driver_info = BTUSB_ATH3012 }, | |
| 205 | 207 | { USB_DEVICE(0x13d3, 0x3362), .driver_info = BTUSB_ATH3012 }, |
| 206 | 208 | { USB_DEVICE(0x13d3, 0x3375), .driver_info = BTUSB_ATH3012 }, |
| 207 | 209 | { USB_DEVICE(0x13d3, 0x3393), .driver_info = BTUSB_ATH3012 }, |
| @@ -218,6 +220,7 @@ static const struct usb_device_id blacklist_table[] = { · 10 unmodified lines | ||
| 218 | 220 | { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, |
| 219 | 221 | |
| 220 | 222 | /* QCA ROME chipset */ |
| 223 | + { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME }, | |
| 221 | 224 | { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME }, |
| 222 | 225 | { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME }, |
| 223 | 226 | |
| @@ -624,7 +624,7 @@ int __bond_opt_set(struct bonding *bond, · 623 unmodified lines | ||
| 624 | 624 | out: |
| 625 | 625 | if (ret) |
| 626 | 626 | bond_opt_error_interpret(bond, opt, ret, val); |
| 627 | − else | |
| 627 | + else if (bond->dev->reg_state == NETREG_REGISTERED) | |
| 628 | 628 | call_netdevice_notifiers(NETDEV_CHANGEINFODATA, bond->dev); |
| 629 | 629 | |
| 630 | 630 | return ret; |
| @@ -350,6 +350,9 @@ static int macb_mii_probe(struct net_device *dev) · 349 unmodified lines | ||
| 350 | 350 | else |
| 351 | 351 | phydev->supported &= PHY_BASIC_FEATURES; |
| 352 | 352 | |
| 353 | + if (bp->caps & MACB_CAPS_NO_GIGABIT_HALF) | |
| 354 | + phydev->supported &= ~SUPPORTED_1000baseT_Half; | |
| 355 | + | |
| 353 | 356 | phydev->advertising = phydev->supported; |
| 354 | 357 | |
| 355 | 358 | bp->link = 0; |
| @@ -1037,6 +1040,12 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id) · 681 unmodified lines | ||
| 1037 | 1040 | * add that if/when we get our hands on a full-blown MII PHY. |
| 1038 | 1041 | */ |
| 1039 | 1042 | |
| 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 | + */ | |
| 1040 | 1049 | if (status & MACB_BIT(RXUBR)) { |
| 1041 | 1050 | ctrl = macb_readl(bp, NCR); |
| 1042 | 1051 | macb_writel(bp, NCR, ctrl & ~MACB_BIT(RE)); |
| @@ -2693,6 +2702,14 @@ static const struct macb_config emac_config = { · 1650 unmodified lines | ||
| 2693 | 2702 | .init = at91ether_init, |
| 2694 | 2703 | }; |
| 2695 | 2704 | |
| 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 | + | |
| 2696 | 2713 | static const struct of_device_id macb_dt_ids[] = { |
| 2697 | 2714 | { .compatible = "cdns,at32ap7000-macb" }, |
| 2698 | 2715 | { .compatible = "cdns,at91sam9260-macb", .data = &at91sam9260_config }, |
| @@ -2703,6 +2720,7 @@ static const struct of_device_id macb_dt_ids[] = { · 4 unmodified lines | ||
| 2703 | 2720 | { .compatible = "atmel,sama5d4-gem", .data = &sama5d4_config }, |
| 2704 | 2721 | { .compatible = "cdns,at91rm9200-emac", .data = &emac_config }, |
| 2705 | 2722 | { .compatible = "cdns,emac", .data = &emac_config }, |
| 2723 | + { .compatible = "cdns,zynq-gem", .data = &zynq_config }, | |
| 2706 | 2724 | { /* sentinel */ } |
| 2707 | 2725 | }; |
| 2708 | 2726 | MODULE_DEVICE_TABLE(of, macb_dt_ids); |
| @@ -393,6 +393,7 @@ · 392 unmodified lines | ||
| 393 | 393 | #define MACB_CAPS_ISR_CLEAR_ON_WRITE 0x00000001 |
| 394 | 394 | #define MACB_CAPS_USRIO_HAS_CLKEN 0x00000002 |
| 395 | 395 | #define MACB_CAPS_USRIO_DEFAULT_IS_MII 0x00000004 |
| 396 | +#define MACB_CAPS_NO_GIGABIT_HALF 0x00000008 | |
| 396 | 397 | #define MACB_CAPS_FIFO_MODE 0x10000000 |
| 397 | 398 | #define MACB_CAPS_GIGABIT_MODE_AVAILABLE 0x20000000 |
| 398 | 399 | #define MACB_CAPS_SG_DISABLED 0x40000000 |
| @@ -3187,7 +3187,7 @@ int mlx4_SW2HW_CQ_wrapper(struct mlx4_dev *dev, int slave, · 3186 unmodified lines | ||
| 3187 | 3187 | int cqn = vhcr->in_modifier; |
| 3188 | 3188 | struct mlx4_cq_context *cqc = inbox->buf; |
| 3189 | 3189 | int mtt_base = cq_get_mtt_addr(cqc) / dev->caps.mtt_entry_sz; |
| 3190 | − struct res_cq *cq; | |
| 3190 | + struct res_cq *cq = NULL; | |
| 3191 | 3191 | struct res_mtt *mtt; |
| 3192 | 3192 | |
| 3193 | 3193 | 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 | ||
| 3223 | 3223 | { |
| 3224 | 3224 | int err; |
| 3225 | 3225 | int cqn = vhcr->in_modifier; |
| 3226 | − struct res_cq *cq; | |
| 3226 | + struct res_cq *cq = NULL; | |
| 3227 | 3227 | |
| 3228 | 3228 | err = cq_res_start_move_to(dev, slave, cqn, RES_CQ_ALLOCATED, &cq); |
| 3229 | 3229 | if (err) |
| @@ -3362,7 +3362,7 @@ int mlx4_SW2HW_SRQ_wrapper(struct mlx4_dev *dev, int slave, · 132 unmodified lines | ||
| 3362 | 3362 | int err; |
| 3363 | 3363 | int srqn = vhcr->in_modifier; |
| 3364 | 3364 | struct res_mtt *mtt; |
| 3365 | − struct res_srq *srq; | |
| 3365 | + struct res_srq *srq = NULL; | |
| 3366 | 3366 | struct mlx4_srq_context *srqc = inbox->buf; |
| 3367 | 3367 | int mtt_base = srq_get_mtt_addr(srqc) / dev->caps.mtt_entry_sz; |
| 3368 | 3368 | |
| @@ -3406,7 +3406,7 @@ int mlx4_HW2SW_SRQ_wrapper(struct mlx4_dev *dev, int slave, · 37 unmodified lines | ||
| 3406 | 3406 | { |
| 3407 | 3407 | int err; |
| 3408 | 3408 | int srqn = vhcr->in_modifier; |
| 3409 | − struct res_srq *srq; | |
| 3409 | + struct res_srq *srq = NULL; | |
| 3410 | 3410 | |
| 3411 | 3411 | err = srq_res_start_move_to(dev, slave, srqn, RES_SRQ_ALLOCATED, &srq); |
| 3412 | 3412 | if (err) |
| @@ -2921,10 +2921,11 @@ static int rocker_port_ipv4_resolve(struct rocker_port *rocker_port, · 2920 unmodified lines | ||
| 2921 | 2921 | struct neighbour *n = __ipv4_neigh_lookup(dev, (__force u32)ip_addr); |
| 2922 | 2922 | int err = 0; |
| 2923 | 2923 | |
| 2924 | − if (!n) | |
| 2924 | + if (!n) { | |
| 2925 | 2925 | 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 | + } | |
| 2928 | 2929 | |
| 2929 | 2930 | /* If the neigh is already resolved, then go ahead and |
| 2930 | 2931 | * 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 | ||
| 2936 | 2937 | else |
| 2937 | 2938 | neigh_event_send(n, NULL); |
| 2938 | 2939 | |
| 2940 | + neigh_release(n); | |
| 2939 | 2941 | return err; |
| 2940 | 2942 | } |
| 2941 | 2943 | |
| @@ -742,6 +742,9 @@ EXPORT_SYMBOL(phy_stop); · 741 unmodified lines | ||
| 742 | 742 | */ |
| 743 | 743 | void phy_start(struct phy_device *phydev) |
| 744 | 744 | { |
| 745 | + bool do_resume = false; | |
| 746 | + int err = 0; | |
| 747 | + | |
| 745 | 748 | mutex_lock(&phydev->lock); |
| 746 | 749 | |
| 747 | 750 | switch (phydev->state) { |
| @@ -752,11 +755,22 @@ void phy_start(struct phy_device *phydev) · 4 unmodified lines | ||
| 752 | 755 | phydev->state = PHY_UP; |
| 753 | 756 | break; |
| 754 | 757 | 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 | + | |
| 755 | 763 | phydev->state = PHY_RESUMING; |
| 764 | + do_resume = true; | |
| 765 | + break; | |
| 756 | 766 | default: |
| 757 | 767 | break; |
| 758 | 768 | } |
| 759 | 769 | mutex_unlock(&phydev->lock); |
| 770 | + | |
| 771 | + /* if phy was suspended, bring the physical link up again */ | |
| 772 | + if (do_resume) | |
| 773 | + phy_resume(phydev); | |
| 760 | 774 | } |
| 761 | 775 | EXPORT_SYMBOL(phy_start); |
| 762 | 776 | |
| @@ -769,7 +783,7 @@ void phy_state_machine(struct work_struct *work) · 6 unmodified lines | ||
| 769 | 783 | struct delayed_work *dwork = to_delayed_work(work); |
| 770 | 784 | struct phy_device *phydev = |
| 771 | 785 | 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; | |
| 773 | 787 | int err = 0; |
| 774 | 788 | |
| 775 | 789 | mutex_lock(&phydev->lock); |
| @@ -888,14 +902,6 @@ void phy_state_machine(struct work_struct *work) · 112 unmodified lines | ||
| 888 | 902 | } |
| 889 | 903 | break; |
| 890 | 904 | 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 | − | |
| 899 | 905 | if (AUTONEG_ENABLE == phydev->autoneg) { |
| 900 | 906 | err = phy_aneg_done(phydev); |
| 901 | 907 | if (err < 0) |
| @@ -933,7 +939,6 @@ void phy_state_machine(struct work_struct *work) · 31 unmodified lines | ||
| 933 | 939 | } |
| 934 | 940 | phydev->adjust_link(phydev->attached_dev); |
| 935 | 941 | } |
| 936 | − do_resume = true; | |
| 937 | 942 | break; |
| 938 | 943 | } |
| 939 | 944 | |
| @@ -943,8 +948,6 @@ void phy_state_machine(struct work_struct *work) · 3 unmodified lines | ||
| 943 | 948 | err = phy_start_aneg(phydev); |
| 944 | 949 | else if (do_suspend) |
| 945 | 950 | phy_suspend(phydev); |
| 946 | − else if (do_resume) | |
| 947 | − phy_resume(phydev); | |
| 948 | 951 | |
| 949 | 952 | if (err < 0) |
| 950 | 953 | phy_error(phydev); |
| @@ -1053,13 +1056,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) · 102 unmodified lines | ||
| 1053 | 1056 | { |
| 1054 | 1057 | /* According to 802.3az,the EEE is supported only in full duplex-mode. |
| 1055 | 1058 | * 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. | |
| 1058 | 1061 | */ |
| 1059 | 1062 | if ((phydev->duplex == DUPLEX_FULL) && |
| 1060 | 1063 | ((phydev->interface == PHY_INTERFACE_MODE_MII) || |
| 1061 | 1064 | (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) || | |
| 1063 | 1067 | phy_is_internal(phydev))) { |
| 1064 | 1068 | int eee_lp, eee_cap, eee_adv; |
| 1065 | 1069 | u32 lp, cap, adv; |
| @@ -1182,7 +1182,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) · 1181 unmodified lines | ||
| 1182 | 1182 | * payload data instead. |
| 1183 | 1183 | */ |
| 1184 | 1184 | 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); | |
| 1186 | 1186 | |
| 1187 | 1187 | return skb_out; |
| 1188 | 1188 | |
| @@ -2961,7 +2961,7 @@ static void __net_exit vxlan_exit_net(struct net *net) · 2960 unmodified lines | ||
| 2961 | 2961 | * to the list by the previous loop. |
| 2962 | 2962 | */ |
| 2963 | 2963 | if (!net_eq(dev_net(vxlan->dev), net)) |
| 2964 | − unregister_netdevice_queue(dev, &list); | |
| 2964 | + unregister_netdevice_queue(vxlan->dev, &list); | |
| 2965 | 2965 | } |
| 2966 | 2966 | |
| 2967 | 2967 | unregister_netdevice_many(&list); |
| @@ -17,6 +17,7 @@ · 16 unmodified lines | ||
| 17 | 17 | #ifndef _LINUX_RHASHTABLE_H |
| 18 | 18 | #define _LINUX_RHASHTABLE_H |
| 19 | 19 | |
| 20 | +#include <linux/atomic.h> | |
| 20 | 21 | #include <linux/compiler.h> |
| 21 | 22 | #include <linux/errno.h> |
| 22 | 23 | #include <linux/jhash.h> |
| @@ -100,6 +101,7 @@ struct rhashtable; · 77 unmodified lines | ||
| 100 | 101 | * @key_len: Length of key |
| 101 | 102 | * @key_offset: Offset of key in struct to be hashed |
| 102 | 103 | * @head_offset: Offset of rhash_head in struct to be hashed |
| 104 | + * @insecure_max_entries: Maximum number of entries (may be exceeded) | |
| 103 | 105 | * @max_size: Maximum size while expanding |
| 104 | 106 | * @min_size: Minimum size while shrinking |
| 105 | 107 | * @nulls_base: Base value to generate nulls marker |
| @@ -115,6 +117,7 @@ struct rhashtable_params { · 9 unmodified lines | ||
| 115 | 117 | size_t key_len; |
| 116 | 118 | size_t key_offset; |
| 117 | 119 | size_t head_offset; |
| 120 | + unsigned int insecure_max_entries; | |
| 118 | 121 | unsigned int max_size; |
| 119 | 122 | unsigned int min_size; |
| 120 | 123 | u32 nulls_base; |
| @@ -286,6 +289,18 @@ static inline bool rht_grow_above_100(const struct rhashtable *ht, · 165 unmodified lines | ||
| 286 | 289 | (!ht->p.max_size || tbl->size < ht->p.max_size); |
| 287 | 290 | } |
| 288 | 291 | |
| 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 | + | |
| 289 | 304 | /* The bucket lock is selected based on the hash and protects mutations |
| 290 | 305 | * on a group of hash buckets. |
| 291 | 306 | * |
| @@ -589,6 +604,10 @@ restart: · 297 unmodified lines | ||
| 589 | 604 | goto out; |
| 590 | 605 | } |
| 591 | 606 | |
| 607 | + err = -E2BIG; | |
| 608 | + if (unlikely(rht_grow_above_max(ht, tbl))) | |
| 609 | + goto out; | |
| 610 | + | |
| 592 | 611 | if (unlikely(rht_grow_above_100(ht, tbl))) { |
| 593 | 612 | slow_path: |
| 594 | 613 | spin_unlock_bh(lock); |
| @@ -176,6 +176,7 @@ struct nf_bridge_info { · 175 unmodified lines | ||
| 176 | 176 | struct net_device *physindev; |
| 177 | 177 | struct net_device *physoutdev; |
| 178 | 178 | char neigh_header[8]; |
| 179 | + __be32 ipv4_daddr; | |
| 179 | 180 | }; |
| 180 | 181 | #endif |
| 181 | 182 | |
| @@ -158,6 +158,8 @@ struct tcp_sock { · 157 unmodified lines | ||
| 158 | 158 | * sum(delta(snd_una)), or how many bytes |
| 159 | 159 | * were acked. |
| 160 | 160 | */ |
| 161 | + struct u64_stats_sync syncp; /* protects 64bit vars (cf tcp_get_info()) */ | |
| 162 | + | |
| 161 | 163 | u32 snd_una; /* First byte we want an ack for */ |
| 162 | 164 | u32 snd_sml; /* Last byte of the most recently transmitted small packet */ |
| 163 | 165 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
| @@ -129,9 +129,10 @@ struct inet_connection_sock { · 128 unmodified lines | ||
| 129 | 129 | |
| 130 | 130 | u32 probe_timestamp; |
| 131 | 131 | } icsk_mtup; |
| 132 | − u32 icsk_ca_priv[16]; | |
| 133 | 132 | 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)) | |
| 135 | 136 | }; |
| 136 | 137 | |
| 137 | 138 | #define ICSK_TIME_RETRANS 1 /* Retransmit timer */ |
| @@ -42,6 +42,9 @@ enum tcp_conntrack { · 41 unmodified lines | ||
| 42 | 42 | /* The field td_maxack has been set */ |
| 43 | 43 | #define IP_CT_TCP_FLAG_MAXACK_SET 0x20 |
| 44 | 44 | |
| 45 | +/* Marks possibility for expected RFC5961 challenge ACK */ | |
| 46 | +#define IP_CT_EXP_CHALLENGE_ACK 0x40 | |
| 47 | + | |
| 45 | 48 | struct nf_ct_tcp_flags { |
| 46 | 49 | __u8 flags; |
| 47 | 50 | __u8 mask; |
| @@ -337,7 +337,7 @@ struct rtnexthop { · 336 unmodified lines | ||
| 337 | 337 | #define RTNH_F_DEAD 1 /* Nexthop is dead (used by multipath) */ |
| 338 | 338 | #define RTNH_F_PERVASIVE 2 /* Do recursive gateway lookup */ |
| 339 | 339 | #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 */ | |
| 341 | 341 | |
| 342 | 342 | /* Macros to handle hexthops */ |
| 343 | 343 | |
| @@ -14,6 +14,7 @@ · 13 unmodified lines | ||
| 14 | 14 | * published by the Free Software Foundation. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | +#include <linux/atomic.h> | |
| 17 | 18 | #include <linux/kernel.h> |
| 18 | 19 | #include <linux/init.h> |
| 19 | 20 | #include <linux/log2.h> |
| @@ -446,6 +447,10 @@ int rhashtable_insert_slow(struct rhashtable *ht, const void *key, · 426 unmodified lines | ||
| 446 | 447 | if (key && rhashtable_lookup_fast(ht, key, ht->p)) |
| 447 | 448 | goto exit; |
| 448 | 449 | |
| 450 | + err = -E2BIG; | |
| 451 | + if (unlikely(rht_grow_above_max(ht, tbl))) | |
| 452 | + goto exit; | |
| 453 | + | |
| 449 | 454 | err = -EAGAIN; |
| 450 | 455 | if (rhashtable_check_elasticity(ht, tbl, hash) || |
| 451 | 456 | rht_grow_above_100(ht, tbl)) |
| @@ -738,6 +743,12 @@ int rhashtable_init(struct rhashtable *ht, · 286 unmodified lines | ||
| 738 | 743 | if (params->max_size) |
| 739 | 744 | ht->p.max_size = rounddown_pow_of_two(params->max_size); |
| 740 | 745 | |
| 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 | + | |
| 741 | 752 | ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE); |
| 742 | 753 | |
| 743 | 754 | /* The maximum (not average) chain length grows with the |
| @@ -443,7 +443,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event, · 442 unmodified lines | ||
| 443 | 443 | case NETDEV_UP: |
| 444 | 444 | /* Put all VLANs for this dev in the up state too. */ |
| 445 | 445 | vlan_group_for_each_dev(grp, i, vlandev) { |
| 446 | − flgs = vlandev->flags; | |
| 446 | + flgs = dev_get_flags(vlandev); | |
| 447 | 447 | if (flgs & IFF_UP) |
| 448 | 448 | continue; |
| 449 | 449 | |
| @@ -2854,9 +2854,11 @@ static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status, · 2853 unmodified lines | ||
| 2854 | 2854 | * state. If we were running both LE and BR/EDR inquiry |
| 2855 | 2855 | * simultaneously, and BR/EDR inquiry is already |
| 2856 | 2856 | * 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. | |
| 2858 | 2859 | */ |
| 2859 | − if (!test_bit(HCI_INQUIRY, &hdev->flags)) | |
| 2860 | + if (!test_bit(HCI_INQUIRY, &hdev->flags) && | |
| 2861 | + hdev->discovery.state != DISCOVERY_RESOLVING) | |
| 2860 | 2862 | hci_discovery_set_state(hdev, |
| 2861 | 2863 | DISCOVERY_STOPPED); |
| 2862 | 2864 | } else { |
| @@ -1072,7 +1072,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, · 1071 unmodified lines | ||
| 1072 | 1072 | |
| 1073 | 1073 | err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, |
| 1074 | 1074 | vid); |
| 1075 | − if (!err) | |
| 1075 | + if (err) | |
| 1076 | 1076 | break; |
| 1077 | 1077 | } |
| 1078 | 1078 | |
| @@ -37,10 +37,6 @@ · 36 unmodified lines | ||
| 37 | 37 | #include <net/route.h> |
| 38 | 38 | #include <net/netfilter/br_netfilter.h> |
| 39 | 39 | |
| 40 | −#if IS_ENABLED(CONFIG_NF_CONNTRACK) | |
| 41 | −#include <net/netfilter/nf_conntrack.h> | |
| 42 | −#endif | |
| 43 | − | |
| 44 | 40 | #include <asm/uaccess.h> |
| 45 | 41 | #include "br_private.h" |
| 46 | 42 | #ifdef CONFIG_SYSCTL |
| @@ -350,24 +346,15 @@ free_skb: · 303 unmodified lines | ||
| 350 | 346 | return 0; |
| 351 | 347 | } |
| 352 | 348 | |
| 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) | |
| 354 | 351 | { |
| 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; | |
| 367 | 353 | } |
| 368 | 354 | |
| 369 | 355 | /* This requires some explaining. If DNAT has taken place, |
| 370 | 356 | * we will need to fix up the destination Ethernet address. |
| 357 | + * This is also true when SNAT takes place (for the reply direction). | |
| 371 | 358 | * |
| 372 | 359 | * There are two cases to consider: |
| 373 | 360 | * 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 | ||
| 421 | 408 | nf_bridge->pkt_otherhost = false; |
| 422 | 409 | } |
| 423 | 410 | nf_bridge->mask ^= BRNF_NF_BRIDGE_PREROUTING; |
| 424 | − if (dnat_took_place(skb)) { | |
| 411 | + if (daddr_was_changed(skb, nf_bridge)) { | |
| 425 | 412 | if ((err = ip_route_input(skb, iph->daddr, iph->saddr, iph->tos, dev))) { |
| 426 | 413 | struct in_device *in_dev = __in_dev_get_rcu(dev); |
| 427 | 414 | |
| @@ -632,6 +619,7 @@ static unsigned int br_nf_pre_routing(const struct nf_hook_ops *ops, · 204 unmodified lines | ||
| 632 | 619 | struct sk_buff *skb, |
| 633 | 620 | const struct nf_hook_state *state) |
| 634 | 621 | { |
| 622 | + struct nf_bridge_info *nf_bridge; | |
| 635 | 623 | struct net_bridge_port *p; |
| 636 | 624 | struct net_bridge *br; |
| 637 | 625 | __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 | ||
| 669 | 657 | if (!setup_pre_routing(skb)) |
| 670 | 658 | return NF_DROP; |
| 671 | 659 | |
| 660 | + nf_bridge = nf_bridge_info_get(skb); | |
| 661 | + nf_bridge->ipv4_daddr = ip_hdr(skb)->daddr; | |
| 662 | + | |
| 672 | 663 | skb->protocol = htons(ETH_P_IP); |
| 673 | 664 | |
| 674 | 665 | NF_HOOK(NFPROTO_IPV4, NF_INET_PRE_ROUTING, state->sk, skb, |
| @@ -97,7 +97,9 @@ static void br_forward_delay_timer_expired(unsigned long arg) · 96 unmodified lines | ||
| 97 | 97 | netif_carrier_on(br->dev); |
| 98 | 98 | } |
| 99 | 99 | br_log_state(p); |
| 100 | + rcu_read_lock(); | |
| 100 | 101 | br_ifinfo_notify(RTM_NEWLINK, p); |
| 102 | + rcu_read_unlock(); | |
| 101 | 103 | spin_unlock(&br->lock); |
| 102 | 104 | } |
| 103 | 105 | |
| @@ -1117,6 +1117,8 @@ static int do_replace(struct net *net, const void __user *user, · 1116 unmodified lines | ||
| 1117 | 1117 | return -ENOMEM; |
| 1118 | 1118 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
| 1119 | 1119 | return -ENOMEM; |
| 1120 | + if (tmp.num_counters == 0) | |
| 1121 | + return -EINVAL; | |
| 1120 | 1122 | |
| 1121 | 1123 | tmp.name[sizeof(tmp.name) - 1] = 0; |
| 1122 | 1124 | |
| @@ -2159,6 +2161,8 @@ static int compat_copy_ebt_replace_from_user(struct ebt_replace *repl, · 1036 unmodified lines | ||
| 2159 | 2161 | return -ENOMEM; |
| 2160 | 2162 | if (tmp.num_counters >= INT_MAX / sizeof(struct ebt_counter)) |
| 2161 | 2163 | return -ENOMEM; |
| 2164 | + if (tmp.num_counters == 0) | |
| 2165 | + return -EINVAL; | |
| 2162 | 2166 | |
| 2163 | 2167 | memcpy(repl, &tmp, offsetof(struct ebt_replace, hook_entry)); |
| 2164 | 2168 | |
| @@ -359,7 +359,15 @@ static int ethtool_get_settings(struct net_device *dev, void __user *useraddr) · 358 unmodified lines | ||
| 359 | 359 | int err; |
| 360 | 360 | struct ethtool_cmd cmd; |
| 361 | 361 | |
| 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); | |
| 363 | 371 | if (err < 0) |
| 364 | 372 | return err; |
| 365 | 373 | |
| @@ -2416,6 +2416,9 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change, · 2415 unmodified lines | ||
| 2416 | 2416 | { |
| 2417 | 2417 | struct sk_buff *skb; |
| 2418 | 2418 | |
| 2419 | + if (dev->reg_state != NETREG_REGISTERED) | |
| 2420 | + return; | |
| 2421 | + | |
| 2419 | 2422 | skb = rtmsg_ifinfo_build_skb(type, dev, change, flags); |
| 2420 | 2423 | if (skb) |
| 2421 | 2424 | rtmsg_ifinfo_send(skb, dev, flags); |
| @@ -1164,6 +1164,7 @@ int fib_table_insert(struct fib_table *tb, struct fib_config *cfg) · 1163 unmodified lines | ||
| 1164 | 1164 | state = fa->fa_state; |
| 1165 | 1165 | new_fa->fa_state = state & ~FA_S_ACCESSED; |
| 1166 | 1166 | new_fa->fa_slen = fa->fa_slen; |
| 1167 | + new_fa->tb_id = tb->tb_id; | |
| 1167 | 1168 | |
| 1168 | 1169 | err = netdev_switch_fib_ipv4_add(key, plen, fi, |
| 1169 | 1170 | new_fa->fa_tos, |
| @@ -1764,7 +1765,7 @@ void fib_table_flush_external(struct fib_table *tb) · 594 unmodified lines | ||
| 1764 | 1765 | /* record local slen */ |
| 1765 | 1766 | slen = fa->fa_slen; |
| 1766 | 1767 | |
| 1767 | − if (!fi || !(fi->fib_flags & RTNH_F_EXTERNAL)) | |
| 1768 | + if (!fi || !(fi->fib_flags & RTNH_F_OFFLOAD)) | |
| 1768 | 1769 | continue; |
| 1769 | 1770 | |
| 1770 | 1771 | netdev_switch_fib_ipv4_del(n->key, |
| @@ -1075,6 +1075,9 @@ static int do_replace(struct net *net, const void __user *user, · 1074 unmodified lines | ||
| 1075 | 1075 | /* overflow check */ |
| 1076 | 1076 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
| 1077 | 1077 | return -ENOMEM; |
| 1078 | + if (tmp.num_counters == 0) | |
| 1079 | + return -EINVAL; | |
| 1080 | + | |
| 1078 | 1081 | tmp.name[sizeof(tmp.name)-1] = 0; |
| 1079 | 1082 | |
| 1080 | 1083 | 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 | ||
| 1499 | 1502 | return -ENOMEM; |
| 1500 | 1503 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
| 1501 | 1504 | return -ENOMEM; |
| 1505 | + if (tmp.num_counters == 0) | |
| 1506 | + return -EINVAL; | |
| 1507 | + | |
| 1502 | 1508 | tmp.name[sizeof(tmp.name)-1] = 0; |
| 1503 | 1509 | |
| 1504 | 1510 | newinfo = xt_alloc_table_info(tmp.size); |
| @@ -1262,6 +1262,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) · 1261 unmodified lines | ||
| 1262 | 1262 | /* overflow check */ |
| 1263 | 1263 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
| 1264 | 1264 | return -ENOMEM; |
| 1265 | + if (tmp.num_counters == 0) | |
| 1266 | + return -EINVAL; | |
| 1267 | + | |
| 1265 | 1268 | tmp.name[sizeof(tmp.name)-1] = 0; |
| 1266 | 1269 | |
| 1267 | 1270 | 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 | ||
| 1809 | 1812 | return -ENOMEM; |
| 1810 | 1813 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
| 1811 | 1814 | return -ENOMEM; |
| 1815 | + if (tmp.num_counters == 0) | |
| 1816 | + return -EINVAL; | |
| 1817 | + | |
| 1812 | 1818 | tmp.name[sizeof(tmp.name)-1] = 0; |
| 1813 | 1819 | |
| 1814 | 1820 | newinfo = xt_alloc_table_info(tmp.size); |
| @@ -902,6 +902,10 @@ static int ip_error(struct sk_buff *skb) · 901 unmodified lines | ||
| 902 | 902 | bool send; |
| 903 | 903 | int code; |
| 904 | 904 | |
| 905 | + /* IP on this device is disabled. */ | |
| 906 | + if (!in_dev) | |
| 907 | + goto out; | |
| 908 | + | |
| 905 | 909 | net = dev_net(rt->dst.dev); |
| 906 | 910 | if (!IN_DEV_FORWARD(in_dev)) { |
| 907 | 911 | switch (rt->dst.error) { |
| @@ -402,6 +402,7 @@ void tcp_init_sock(struct sock *sk) · 401 unmodified lines | ||
| 402 | 402 | tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; |
| 403 | 403 | tp->snd_cwnd_clamp = ~0; |
| 404 | 404 | tp->mss_cache = TCP_MSS_DEFAULT; |
| 405 | + u64_stats_init(&tp->syncp); | |
| 405 | 406 | |
| 406 | 407 | tp->reordering = sysctl_tcp_reordering; |
| 407 | 408 | tcp_enable_early_retrans(tp); |
| @@ -2598,6 +2599,7 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 2190 unmodified lines | ||
| 2598 | 2599 | const struct tcp_sock *tp = tcp_sk(sk); |
| 2599 | 2600 | const struct inet_connection_sock *icsk = inet_csk(sk); |
| 2600 | 2601 | u32 now = tcp_time_stamp; |
| 2602 | + unsigned int start; | |
| 2601 | 2603 | u32 rate; |
| 2602 | 2604 | |
| 2603 | 2605 | memset(info, 0, sizeof(*info)); |
| @@ -2665,10 +2667,11 @@ void tcp_get_info(struct sock *sk, struct tcp_info *info) · 61 unmodified lines | ||
| 2665 | 2667 | rate = READ_ONCE(sk->sk_max_pacing_rate); |
| 2666 | 2668 | info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; |
| 2667 | 2669 | |
| 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)); | |
| 2672 | 2675 | } |
| 2673 | 2676 | EXPORT_SYMBOL_GPL(tcp_get_info); |
| 2674 | 2677 | |
| @@ -206,6 +206,10 @@ static bool tcp_fastopen_create_child(struct sock *sk, · 205 unmodified lines | ||
| 206 | 206 | skb_set_owner_r(skb2, child); |
| 207 | 207 | __skb_queue_tail(&child->sk_receive_queue, skb2); |
| 208 | 208 | 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 | + */ | |
| 209 | 213 | tp->bytes_received = end_seq - TCP_SKB_CB(skb)->seq - 1; |
| 210 | 214 | } else { |
| 211 | 215 | end_seq = TCP_SKB_CB(skb)->seq + 1; |
| @@ -2698,16 +2698,21 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack) · 2697 unmodified lines | ||
| 2698 | 2698 | struct tcp_sock *tp = tcp_sk(sk); |
| 2699 | 2699 | bool recovered = !before(tp->snd_una, tp->high_seq); |
| 2700 | 2700 | |
| 2701 | + if ((flag & FLAG_SND_UNA_ADVANCED) && | |
| 2702 | + tcp_try_undo_loss(sk, false)) | |
| 2703 | + return; | |
| 2704 | + | |
| 2701 | 2705 | if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */ |
| 2702 | 2706 | /* Step 3.b. A timeout is spurious if not all data are |
| 2703 | 2707 | * lost, i.e., never-retransmitted data are (s)acked. |
| 2704 | 2708 | */ |
| 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)) | |
| 2706 | 2711 | return; |
| 2707 | 2712 | |
| 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 */ | |
| 2711 | 2716 | } else if (flag & FLAG_SND_UNA_ADVANCED && !recovered) { |
| 2712 | 2717 | tp->high_seq = tp->snd_nxt; |
| 2713 | 2718 | __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 | ||
| 2732 | 2737 | else if (flag & FLAG_SND_UNA_ADVANCED) |
| 2733 | 2738 | tcp_reset_reno_sack(tp); |
| 2734 | 2739 | } |
| 2735 | − if (tcp_try_undo_loss(sk, false)) | |
| 2736 | − return; | |
| 2737 | 2740 | tcp_xmit_retransmit_queue(sk); |
| 2738 | 2741 | } |
| 2739 | 2742 | |
| @@ -3283,7 +3286,9 @@ static void tcp_snd_una_update(struct tcp_sock *tp, u32 ack) · 543 unmodified lines | ||
| 3283 | 3286 | { |
| 3284 | 3287 | u32 delta = ack - tp->snd_una; |
| 3285 | 3288 | |
| 3289 | + u64_stats_update_begin(&tp->syncp); | |
| 3286 | 3290 | tp->bytes_acked += delta; |
| 3291 | + u64_stats_update_end(&tp->syncp); | |
| 3287 | 3292 | tp->snd_una = ack; |
| 3288 | 3293 | } |
| 3289 | 3294 | |
| @@ -3292,7 +3297,9 @@ static void tcp_rcv_nxt_update(struct tcp_sock *tp, u32 seq) · 2 unmodified lines | ||
| 3292 | 3297 | { |
| 3293 | 3298 | u32 delta = seq - tp->rcv_nxt; |
| 3294 | 3299 | |
| 3300 | + u64_stats_update_begin(&tp->syncp); | |
| 3295 | 3301 | tp->bytes_received += delta; |
| 3302 | + u64_stats_update_end(&tp->syncp); | |
| 3296 | 3303 | tp->rcv_nxt = seq; |
| 3297 | 3304 | } |
| 3298 | 3305 | |
| @@ -300,7 +300,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) · 299 unmodified lines | ||
| 300 | 300 | tw->tw_v6_daddr = sk->sk_v6_daddr; |
| 301 | 301 | tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr; |
| 302 | 302 | 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); | |
| 304 | 304 | tw->tw_ipv6only = sk->sk_ipv6only; |
| 305 | 305 | } |
| 306 | 306 | #endif |
| @@ -693,6 +693,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, · 692 unmodified lines | ||
| 693 | 693 | { |
| 694 | 694 | struct rt6_info *iter = NULL; |
| 695 | 695 | struct rt6_info **ins; |
| 696 | + struct rt6_info **fallback_ins = NULL; | |
| 696 | 697 | int replace = (info->nlh && |
| 697 | 698 | (info->nlh->nlmsg_flags & NLM_F_REPLACE)); |
| 698 | 699 | int add = (!info->nlh || |
| @@ -716,8 +717,13 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt, · 17 unmodified lines | ||
| 716 | 717 | (info->nlh->nlmsg_flags & NLM_F_EXCL)) |
| 717 | 718 | return -EEXIST; |
| 718 | 719 | 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; | |
| 721 | 727 | } |
| 722 | 728 | |
| 723 | 729 | 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 | ||
| 753 | 759 | if (iter->rt6i_metric > rt->rt6i_metric) |
| 754 | 760 | break; |
| 755 | 761 | |
| 762 | +next_iter: | |
| 756 | 763 | ins = &iter->dst.rt6_next; |
| 757 | 764 | } |
| 758 | 765 | |
| 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 | + | |
| 759 | 773 | /* Reset round-robin state, if necessary */ |
| 760 | 774 | if (ins == &fn->leaf) |
| 761 | 775 | fn->rr_ptr = NULL; |
| @@ -815,6 +829,8 @@ add: · 53 unmodified lines | ||
| 815 | 829 | } |
| 816 | 830 | |
| 817 | 831 | } else { |
| 832 | + int nsiblings; | |
| 833 | + | |
| 818 | 834 | if (!found) { |
| 819 | 835 | if (add) |
| 820 | 836 | goto add; |
| @@ -835,8 +851,27 @@ add: · 14 unmodified lines | ||
| 835 | 851 | info->nl_net->ipv6.rt6_stats->fib_route_nodes++; |
| 836 | 852 | fn->fn_flags |= RTN_RTINFO; |
| 837 | 853 | } |
| 854 | + nsiblings = iter->rt6i_nsiblings; | |
| 838 | 855 | fib6_purge_rt(iter, fn, info->nl_net); |
| 839 | 856 | 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 | + } | |
| 840 | 875 | } |
| 841 | 876 | |
| 842 | 877 | return 0; |
| @@ -1300,8 +1300,10 @@ emsgsize: · 1299 unmodified lines | ||
| 1300 | 1300 | |
| 1301 | 1301 | /* If this is the first and only packet and device |
| 1302 | 1302 | * supports checksum offloading, let's use it. |
| 1303 | + * Use transhdrlen, same as IPv4, because partial | |
| 1304 | + * sums only work when transhdrlen is set. | |
| 1303 | 1305 | */ |
| 1304 | − if (!skb && sk->sk_protocol == IPPROTO_UDP && | |
| 1306 | + if (transhdrlen && sk->sk_protocol == IPPROTO_UDP && | |
| 1305 | 1307 | length + fragheaderlen < mtu && |
| 1306 | 1308 | rt->dst.dev->features & NETIF_F_V6_CSUM && |
| 1307 | 1309 | !exthdrlen) |
| @@ -1275,6 +1275,9 @@ do_replace(struct net *net, const void __user *user, unsigned int len) · 1274 unmodified lines | ||
| 1275 | 1275 | /* overflow check */ |
| 1276 | 1276 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
| 1277 | 1277 | return -ENOMEM; |
| 1278 | + if (tmp.num_counters == 0) | |
| 1279 | + return -EINVAL; | |
| 1280 | + | |
| 1278 | 1281 | tmp.name[sizeof(tmp.name)-1] = 0; |
| 1279 | 1282 | |
| 1280 | 1283 | 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 | ||
| 1822 | 1825 | return -ENOMEM; |
| 1823 | 1826 | if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) |
| 1824 | 1827 | return -ENOMEM; |
| 1828 | + if (tmp.num_counters == 0) | |
| 1829 | + return -EINVAL; | |
| 1830 | + | |
| 1825 | 1831 | tmp.name[sizeof(tmp.name)-1] = 0; |
| 1826 | 1832 | |
| 1827 | 1833 | newinfo = xt_alloc_table_info(tmp.size); |
| @@ -2504,9 +2504,9 @@ static int ip6_route_multipath(struct fib6_config *cfg, int add) · 2503 unmodified lines | ||
| 2504 | 2504 | int attrlen; |
| 2505 | 2505 | int err = 0, last_err = 0; |
| 2506 | 2506 | |
| 2507 | + remaining = cfg->fc_mp_len; | |
| 2507 | 2508 | beginning: |
| 2508 | 2509 | rtnh = (struct rtnexthop *)cfg->fc_mp; |
| 2509 | − remaining = cfg->fc_mp_len; | |
| 2510 | 2510 | |
| 2511 | 2511 | /* Parse a Multipath Entry */ |
| 2512 | 2512 | while (rtnh_ok(rtnh, remaining)) { |
| @@ -2536,15 +2536,19 @@ beginning: · 23 unmodified lines | ||
| 2536 | 2536 | * next hops that have been already added. |
| 2537 | 2537 | */ |
| 2538 | 2538 | add = 0; |
| 2539 | + remaining = cfg->fc_mp_len - remaining; | |
| 2539 | 2540 | goto beginning; |
| 2540 | 2541 | } |
| 2541 | 2542 | } |
| 2542 | 2543 | /* 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. | |
| 2546 | 2549 | */ |
| 2547 | − cfg->fc_nlinfo.nlh->nlmsg_flags &= ~NLM_F_EXCL; | |
| 2550 | + cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | | |
| 2551 | + NLM_F_REPLACE); | |
| 2548 | 2552 | rtnh = rtnh_next(rtnh, &remaining); |
| 2549 | 2553 | } |
| 2550 | 2554 | |
| @@ -914,7 +914,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) · 913 unmodified lines | ||
| 914 | 914 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, |
| 915 | 915 | tcp_time_stamp + tcptw->tw_ts_offset, |
| 916 | 916 | 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)); | |
| 918 | 918 | |
| 919 | 919 | inet_twsk_put(tw); |
| 920 | 920 | } |
| @@ -731,7 +731,9 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk, · 730 unmodified lines | ||
| 731 | 731 | (inet->inet_dport && inet->inet_dport != rmt_port) || |
| 732 | 732 | (!ipv6_addr_any(&sk->sk_v6_daddr) && |
| 733 | 733 | !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))) | |
| 735 | 737 | return false; |
| 736 | 738 | if (!inet6_mc_check(sk, loc_addr, rmt_addr)) |
| 737 | 739 | return false; |
| @@ -98,8 +98,7 @@ static u8 *ieee80211_wep_add_iv(struct ieee80211_local *local, · 97 unmodified lines | ||
| 98 | 98 | |
| 99 | 99 | hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_PROTECTED); |
| 100 | 100 | |
| 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)) | |
| 103 | 102 | return NULL; |
| 104 | 103 | |
| 105 | 104 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
| @@ -167,6 +166,9 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local, · 61 unmodified lines | ||
| 167 | 166 | size_t len; |
| 168 | 167 | u8 rc4key[3 + WLAN_KEY_LEN_WEP104]; |
| 169 | 168 | |
| 169 | + if (WARN_ON(skb_tailroom(skb) < IEEE80211_WEP_ICV_LEN)) | |
| 170 | + return -1; | |
| 171 | + | |
| 170 | 172 | iv = ieee80211_wep_add_iv(local, skb, keylen, keyidx); |
| 171 | 173 | if (!iv) |
| 172 | 174 | return -1; |
| @@ -863,6 +863,7 @@ config NETFILTER_XT_TARGET_TPROXY · 862 unmodified lines | ||
| 863 | 863 | depends on NETFILTER_XTABLES |
| 864 | 864 | depends on NETFILTER_ADVANCED |
| 865 | 865 | depends on (IPV6 || IPV6=n) |
| 866 | + depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) | |
| 866 | 867 | depends on IP_NF_MANGLE |
| 867 | 868 | select NF_DEFRAG_IPV4 |
| 868 | 869 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES |
| @@ -1356,6 +1357,7 @@ config NETFILTER_XT_MATCH_SOCKET · 487 unmodified lines | ||
| 1356 | 1357 | depends on NETFILTER_ADVANCED |
| 1357 | 1358 | depends on !NF_CONNTRACK || NF_CONNTRACK |
| 1358 | 1359 | depends on (IPV6 || IPV6=n) |
| 1360 | + depends on (IP6_NF_IPTABLES || IP6_NF_IPTABLES=n) | |
| 1359 | 1361 | select NF_DEFRAG_IPV4 |
| 1360 | 1362 | select NF_DEFRAG_IPV6 if IP6_NF_IPTABLES |
| 1361 | 1363 | help |
| @@ -3823,6 +3823,9 @@ static void __net_exit ip_vs_control_net_cleanup_sysctl(struct net *net) · 3822 unmodified lines | ||
| 3823 | 3823 | cancel_work_sync(&ipvs->defense_work.work); |
| 3824 | 3824 | unregister_net_sysctl_table(ipvs->sysctl_hdr); |
| 3825 | 3825 | ip_vs_stop_estimator(net, &ipvs->tot_stats); |
| 3826 | + | |
| 3827 | + if (!net_eq(net, &init_net)) | |
| 3828 | + kfree(ipvs->sysctl_tbl); | |
| 3826 | 3829 | } |
| 3827 | 3830 | |
| 3828 | 3831 | #else |
| @@ -202,7 +202,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { · 201 unmodified lines | ||
| 202 | 202 | * sES -> sES :-) |
| 203 | 203 | * sFW -> sCW Normal close request answered by ACK. |
| 204 | 204 | * sCW -> sCW |
| 205 | − * sLA -> sTW Last ACK detected. | |
| 205 | + * sLA -> sTW Last ACK detected (RFC5961 challenged) | |
| 206 | 206 | * sTW -> sTW Retransmitted last ACK. Remain in the same state. |
| 207 | 207 | * sCL -> sCL |
| 208 | 208 | */ |
| @@ -261,7 +261,7 @@ static const u8 tcp_conntracks[2][6][TCP_CONNTRACK_MAX] = { · 52 unmodified lines | ||
| 261 | 261 | * sES -> sES :-) |
| 262 | 262 | * sFW -> sCW Normal close request answered by ACK. |
| 263 | 263 | * sCW -> sCW |
| 264 | − * sLA -> sTW Last ACK detected. | |
| 264 | + * sLA -> sTW Last ACK detected (RFC5961 challenged) | |
| 265 | 265 | * sTW -> sTW Retransmitted last ACK. |
| 266 | 266 | * sCL -> sCL |
| 267 | 267 | */ |
| @@ -906,6 +906,7 @@ static int tcp_packet(struct nf_conn *ct, · 638 unmodified lines | ||
| 906 | 906 | 1 : ct->proto.tcp.last_win; |
| 907 | 907 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].td_scale = |
| 908 | 908 | ct->proto.tcp.last_wscale; |
| 909 | + ct->proto.tcp.last_flags &= ~IP_CT_EXP_CHALLENGE_ACK; | |
| 909 | 910 | ct->proto.tcp.seen[ct->proto.tcp.last_dir].flags = |
| 910 | 911 | ct->proto.tcp.last_flags; |
| 911 | 912 | memset(&ct->proto.tcp.seen[dir], 0, |
| @@ -923,7 +924,9 @@ static int tcp_packet(struct nf_conn *ct, · 11 unmodified lines | ||
| 923 | 924 | * may be in sync but we are not. In that case, we annotate |
| 924 | 925 | * the TCP options and let the packet go through. If it is a |
| 925 | 926 | * 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 | + */ | |
| 927 | 930 | if (index == TCP_SYN_SET && dir == IP_CT_DIR_ORIGINAL) { |
| 928 | 931 | struct ip_ct_tcp_state seen = {}; |
| 929 | 932 | |
| @@ -939,6 +942,13 @@ static int tcp_packet(struct nf_conn *ct, · 9 unmodified lines | ||
| 939 | 942 | ct->proto.tcp.last_flags |= |
| 940 | 943 | IP_CT_TCP_FLAG_SACK_PERM; |
| 941 | 944 | } |
| 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; | |
| 942 | 952 | } |
| 943 | 953 | spin_unlock_bh(&ct->lock); |
| 944 | 954 | if (LOG_INVALID(net, IPPROTO_TCP)) |
| @@ -970,6 +980,25 @@ static int tcp_packet(struct nf_conn *ct, · 25 unmodified lines | ||
| 970 | 980 | nf_log_packet(net, pf, 0, skb, NULL, NULL, NULL, |
| 971 | 981 | "nf_ct_tcp: invalid state "); |
| 972 | 982 | 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; | |
| 973 | 1002 | case TCP_CONNTRACK_CLOSE: |
| 974 | 1003 | if (index == TCP_RST_SET |
| 975 | 1004 | && (ct->proto.tcp.seen[!dir].flags & IP_CT_TCP_FLAG_MAXACK_SET) |
| @@ -4472,9 +4472,9 @@ EXPORT_SYMBOL_GPL(nft_data_init); · 4471 unmodified lines | ||
| 4472 | 4472 | */ |
| 4473 | 4473 | void nft_data_uninit(const struct nft_data *data, enum nft_data_types type) |
| 4474 | 4474 | { |
| 4475 | − switch (type) { | |
| 4476 | − case NFT_DATA_VALUE: | |
| 4475 | + if (type < NFT_DATA_VERDICT) | |
| 4477 | 4476 | return; |
| 4477 | + switch (type) { | |
| 4478 | 4478 | case NFT_DATA_VERDICT: |
| 4479 | 4479 | return nft_verdict_uninit(data); |
| 4480 | 4480 | default: |
| @@ -1073,7 +1073,13 @@ static struct pernet_operations nfnl_log_net_ops = { · 1072 unmodified lines | ||
| 1073 | 1073 | |
| 1074 | 1074 | static int __init nfnetlink_log_init(void) |
| 1075 | 1075 | { |
| 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 | + } | |
| 1077 | 1083 | |
| 1078 | 1084 | netlink_register_notifier(&nfulnl_rtnl_notifier); |
| 1079 | 1085 | status = nfnetlink_subsys_register(&nfulnl_subsys); |
| @@ -1088,28 +1094,23 @@ static int __init nfnetlink_log_init(void) · 8 unmodified lines | ||
| 1088 | 1094 | goto cleanup_subsys; |
| 1089 | 1095 | } |
| 1090 | 1096 | |
| 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 | − } | |
| 1096 | 1097 | return status; |
| 1097 | 1098 | |
| 1098 | −cleanup_logger: | |
| 1099 | − nf_log_unregister(&nfulnl_logger); | |
| 1100 | 1099 | cleanup_subsys: |
| 1101 | 1100 | nfnetlink_subsys_unregister(&nfulnl_subsys); |
| 1102 | 1101 | cleanup_netlink_notifier: |
| 1103 | 1102 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); |
| 1103 | + unregister_pernet_subsys(&nfnl_log_net_ops); | |
| 1104 | +out: | |
| 1104 | 1105 | return status; |
| 1105 | 1106 | } |
| 1106 | 1107 | |
| 1107 | 1108 | static void __exit nfnetlink_log_fini(void) |
| 1108 | 1109 | { |
| 1109 | − unregister_pernet_subsys(&nfnl_log_net_ops); | |
| 1110 | 1110 | nf_log_unregister(&nfulnl_logger); |
| 1111 | 1111 | nfnetlink_subsys_unregister(&nfulnl_subsys); |
| 1112 | 1112 | netlink_unregister_notifier(&nfulnl_rtnl_notifier); |
| 1113 | + unregister_pernet_subsys(&nfnl_log_net_ops); | |
| 1113 | 1114 | } |
| 1114 | 1115 | |
| 1115 | 1116 | MODULE_DESCRIPTION("netfilter userspace logging"); |
| @@ -1317,7 +1317,13 @@ static struct pernet_operations nfnl_queue_net_ops = { · 1316 unmodified lines | ||
| 1317 | 1317 | |
| 1318 | 1318 | static int __init nfnetlink_queue_init(void) |
| 1319 | 1319 | { |
| 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 | + } | |
| 1321 | 1327 | |
| 1322 | 1328 | netlink_register_notifier(&nfqnl_rtnl_notifier); |
| 1323 | 1329 | status = nfnetlink_subsys_register(&nfqnl_subsys); |
| @@ -1326,19 +1332,13 @@ static int __init nfnetlink_queue_init(void) · 2 unmodified lines | ||
| 1326 | 1332 | goto cleanup_netlink_notifier; |
| 1327 | 1333 | } |
| 1328 | 1334 | |
| 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 | − } | |
| 1334 | 1335 | register_netdevice_notifier(&nfqnl_dev_notifier); |
| 1335 | 1336 | nf_register_queue_handler(&nfqh); |
| 1336 | 1337 | return status; |
| 1337 | 1338 | |
| 1338 | −cleanup_subsys: | |
| 1339 | − nfnetlink_subsys_unregister(&nfqnl_subsys); | |
| 1340 | 1339 | cleanup_netlink_notifier: |
| 1341 | 1340 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
| 1341 | +out: | |
| 1342 | 1342 | return status; |
| 1343 | 1343 | } |
| 1344 | 1344 | |
| @@ -1346,9 +1346,9 @@ static void __exit nfnetlink_queue_fini(void) · 1 unmodified line | ||
| 1346 | 1346 | { |
| 1347 | 1347 | nf_unregister_queue_handler(); |
| 1348 | 1348 | unregister_netdevice_notifier(&nfqnl_dev_notifier); |
| 1349 | − unregister_pernet_subsys(&nfnl_queue_net_ops); | |
| 1350 | 1349 | nfnetlink_subsys_unregister(&nfqnl_subsys); |
| 1351 | 1350 | netlink_unregister_notifier(&nfqnl_rtnl_notifier); |
| 1351 | + unregister_pernet_subsys(&nfnl_queue_net_ops); | |
| 1352 | 1352 | |
| 1353 | 1353 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ |
| 1354 | 1354 | } |
| @@ -89,7 +89,7 @@ static inline int netlink_is_kernel(struct sock *sk) · 88 unmodified lines | ||
| 89 | 89 | return nlk_sk(sk)->flags & NETLINK_KERNEL_SOCKET; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | −struct netlink_table *nl_table; | |
| 92 | +struct netlink_table *nl_table __read_mostly; | |
| 93 | 93 | EXPORT_SYMBOL_GPL(nl_table); |
| 94 | 94 | |
| 95 | 95 | static DECLARE_WAIT_QUEUE_HEAD(nl_table_wait); |
| @@ -1081,6 +1081,7 @@ static int netlink_insert(struct sock *sk, u32 portid) · 985 unmodified lines | ||
| 1081 | 1081 | if (err) { |
| 1082 | 1082 | if (err == -EEXIST) |
| 1083 | 1083 | err = -EADDRINUSE; |
| 1084 | + nlk_sk(sk)->portid = 0; | |
| 1084 | 1085 | sock_put(sk); |
| 1085 | 1086 | } |
| 1086 | 1087 | |
| @@ -81,6 +81,11 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) · 80 unmodified lines | ||
| 81 | 81 | struct tcf_proto_ops *t; |
| 82 | 82 | int rc = -ENOENT; |
| 83 | 83 | |
| 84 | + /* Wait for outstanding call_rcu()s, if any, from a | |
| 85 | + * tcf_proto_ops's destroy() handler. | |
| 86 | + */ | |
| 87 | + rcu_barrier(); | |
| 88 | + | |
| 84 | 89 | write_lock(&cls_mod_lock); |
| 85 | 90 | list_for_each_entry(t, &tcf_proto_base, head) { |
| 86 | 91 | if (t == ops) { |
| @@ -338,7 +338,7 @@ int netdev_switch_fib_ipv4_add(u32 dst, int dst_len, struct fib_info *fi, · 337 unmodified lines | ||
| 338 | 338 | fi, tos, type, nlflags, |
| 339 | 339 | tb_id); |
| 340 | 340 | if (!err) |
| 341 | − fi->fib_flags |= RTNH_F_EXTERNAL; | |
| 341 | + fi->fib_flags |= RTNH_F_OFFLOAD; | |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | return err; |
| @@ -364,7 +364,7 @@ int netdev_switch_fib_ipv4_del(u32 dst, int dst_len, struct fib_info *fi, · 19 unmodified lines | ||
| 364 | 364 | const struct swdev_ops *ops; |
| 365 | 365 | int err = 0; |
| 366 | 366 | |
| 367 | − if (!(fi->fib_flags & RTNH_F_EXTERNAL)) | |
| 367 | + if (!(fi->fib_flags & RTNH_F_OFFLOAD)) | |
| 368 | 368 | return 0; |
| 369 | 369 | |
| 370 | 370 | 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 | ||
| 376 | 376 | err = ops->swdev_fib_ipv4_del(dev, htonl(dst), dst_len, |
| 377 | 377 | fi, tos, type, tb_id); |
| 378 | 378 | if (!err) |
| 379 | − fi->fib_flags &= ~RTNH_F_EXTERNAL; | |
| 379 | + fi->fib_flags &= ~RTNH_F_OFFLOAD; | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | return err; |