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

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

Pull networking fixes from David Miller:
"First batch of fixes in the new merge window:

1) Double dst_cache free in act_tunnel_key, from Wenxu.

2) Avoid NULL deref in IN_DEV_MFORWARD() by failing early in the
ip_route_input_rcu() path, from Paolo Abeni.

3) Fix appletalk compile regression, from Arnd Bergmann.

4) If SLAB objects reach the TCP sendpage method we are in serious
trouble, so put a debugging check there. From Vasily Averin.

5) Memory leak in hsr layer, from Mao Wenan.

6) Only test GSO type on GSO packets, from Willem de Bruijn.

7) Fix crash in xsk_diag_put_umem(), from Eric Dumazet.

8) Fix VNIC mailbox length in nfp, from Dirk van der Merwe.

9) Fix race in ipv4 route exception handling, from Xin Long.

10) Missing DMA memory barrier in hns3 driver, from Jian Shen.

11) Use after free in __tcf_chain_put(), from Vlad Buslov.

12) Handle inet_csk_reqsk_queue_add() failures, from Guillaume Nault.

13) Return value correction when ip_mc_may_pull() fails, from Eric
Dumazet.

14) Use after free in x25_device_event(), also from Eric"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (72 commits)
gro_cells: make sure device is up in gro_cells_receive()
vxlan: test dev->flags & IFF_UP before calling gro_cells_receive()
net/x25: fix use-after-free in x25_device_event()
isdn: mISDNinfineon: fix potential NULL pointer dereference
net: hns3: fix to stop multiple HNS reset due to the AER changes
ip: fix ip_mc_may_pull() return value
net: keep refcount warning in reqsk_free()
net: stmmac: Avoid one more sometimes uninitialized Clang warning
net: dsa: mv88e6xxx: Set correct interface mode for CPU/DSA ports
rxrpc: Fix client call queueing, waiting for channel
tcp: handle inet_csk_reqsk_queue_add() failures
net: ethernet: sun: Zero initialize class in default case in niu_add_ethtool_tcam_entry
8139too : Add support for U.S. Robotics USR997901A 10/100 Cardbus NIC
fou, fou6: avoid uninit-value in gue_err() and gue6_err()
net: sched: fix potential use-after-free in __tcf_chain_put()
vhost: silence an unused-variable warning
vsock/virtio: fix kernel panic from virtio_transport_reset_no_sock
connector: fix unsafe usage of ->real_parent
vxlan: do not need BH again in vxlan_cleanup()
net: hns3: add dma_rmb() for rx description
...

+709 -235
+4 -5
Documentation/devicetree/bindings/net/stm32-dwmac.txt
··· 14 14 - clock-names: Should be "stmmaceth" for the host clock. 15 15 Should be "mac-clk-tx" for the MAC TX clock. 16 16 Should be "mac-clk-rx" for the MAC RX clock. 17 - For MPU family need to add also "ethstp" for power mode clock and, 18 - "syscfg-clk" for SYSCFG clock. 17 + For MPU family need to add also "ethstp" for power mode clock 19 18 - interrupt-names: Should contain a list of interrupt names corresponding to 20 19 the interrupts in the interrupts property, if available. 21 20 Should be "macirq" for the main MAC IRQ ··· 23 24 encompases the glue register, and the offset of the control register. 24 25 25 26 Optional properties: 26 - - clock-names: For MPU family "mac-clk-ck" for PHY without quartz 27 - - st,int-phyclk (boolean) : valid only where PHY do not have quartz and need to be clock 28 - by RCC 27 + - clock-names: For MPU family "eth-ck" for PHY without quartz 28 + - st,eth-clk-sel (boolean) : set this property in RGMII PHY when you want to select RCC clock instead of ETH_CLK125. 29 + - st,eth-ref-clk-sel (boolean) : set this property in RMII mode when you have PHY without crystal 50MHz and want to select RCC clock instead of ETH_REF_CLK. 29 30 30 31 Example: 31 32
+2
MAINTAINERS
··· 1059 1059 S: Odd fixes 1060 1060 F: drivers/net/appletalk/ 1061 1061 F: net/appletalk/ 1062 + F: include/linux/atalk.h 1063 + F: include/uapi/linux/atalk.h 1062 1064 1063 1065 APPLIED MICRO (APM) X-GENE DEVICE TREE SUPPORT 1064 1066 M: Khuong Dinh <khuong@os.amperecomputing.com>
+15
arch/arm/boot/dts/stm32h743-pinctrl.dtsi
··· 173 173 }; 174 174 }; 175 175 176 + ethernet_rmii: rmii@0 { 177 + pins { 178 + pinmux = <STM32_PINMUX('G', 11, AF11)>, 179 + <STM32_PINMUX('G', 13, AF11)>, 180 + <STM32_PINMUX('G', 12, AF11)>, 181 + <STM32_PINMUX('C', 4, AF11)>, 182 + <STM32_PINMUX('C', 5, AF11)>, 183 + <STM32_PINMUX('A', 7, AF11)>, 184 + <STM32_PINMUX('C', 1, AF11)>, 185 + <STM32_PINMUX('A', 2, AF11)>, 186 + <STM32_PINMUX('A', 1, AF11)>; 187 + slew-rate = <2>; 188 + }; 189 + }; 190 + 176 191 usart1_pins: usart1@0 { 177 192 pins1 { 178 193 pinmux = <STM32_PINMUX('B', 14, AF4)>; /* USART1_TX */
+13
arch/arm/boot/dts/stm32h743.dtsi
··· 513 513 status = "disabled"; 514 514 }; 515 515 }; 516 + 517 + mac: ethernet@40028000 { 518 + compatible = "st,stm32-dwmac", "snps,dwmac-4.10a"; 519 + reg = <0x40028000 0x8000>; 520 + reg-names = "stmmaceth"; 521 + interrupts = <61>; 522 + interrupt-names = "macirq"; 523 + clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx"; 524 + clocks = <&rcc ETH1MAC_CK>, <&rcc ETH1TX_CK>, <&rcc ETH1RX_CK>; 525 + st,syscon = <&syscfg 0x4>; 526 + snps,pbl = <8>; 527 + status = "disabled"; 528 + }; 516 529 }; 517 530 }; 518 531
+17
arch/arm/boot/dts/stm32h743i-disco.dts
··· 67 67 clock-frequency = <25000000>; 68 68 }; 69 69 70 + &mac { 71 + status = "disabled"; 72 + pinctrl-0 = <&ethernet_rmii>; 73 + pinctrl-names = "default"; 74 + phy-mode = "rmii"; 75 + phy-handle = <&phy0>; 76 + 77 + mdio0 { 78 + #address-cells = <1>; 79 + #size-cells = <0>; 80 + compatible = "snps,dwmac-mdio"; 81 + phy0: ethernet-phy@0 { 82 + reg = <0>; 83 + }; 84 + }; 85 + }; 86 + 70 87 &usart2 { 71 88 pinctrl-0 = <&usart2_pins>; 72 89 pinctrl-names = "default";
+17
arch/arm/boot/dts/stm32h743i-eval.dts
··· 105 105 status = "okay"; 106 106 }; 107 107 108 + &mac { 109 + status = "disabled"; 110 + pinctrl-0 = <&ethernet_rmii>; 111 + pinctrl-names = "default"; 112 + phy-mode = "rmii"; 113 + phy-handle = <&phy0>; 114 + 115 + mdio0 { 116 + #address-cells = <1>; 117 + #size-cells = <0>; 118 + compatible = "snps,dwmac-mdio"; 119 + phy0: ethernet-phy@0 { 120 + reg = <0>; 121 + }; 122 + }; 123 + }; 124 + 108 125 &usart1 { 109 126 pinctrl-0 = <&usart1_pins>; 110 127 pinctrl-names = "default";
+18 -4
drivers/connector/cn_proc.c
··· 250 250 { 251 251 struct cn_msg *msg; 252 252 struct proc_event *ev; 253 + struct task_struct *parent; 253 254 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); 254 255 255 256 if (atomic_read(&proc_event_num_listeners) < 1) ··· 263 262 ev->what = PROC_EVENT_COREDUMP; 264 263 ev->event_data.coredump.process_pid = task->pid; 265 264 ev->event_data.coredump.process_tgid = task->tgid; 266 - ev->event_data.coredump.parent_pid = task->real_parent->pid; 267 - ev->event_data.coredump.parent_tgid = task->real_parent->tgid; 265 + 266 + rcu_read_lock(); 267 + if (pid_alive(task)) { 268 + parent = rcu_dereference(task->real_parent); 269 + ev->event_data.coredump.parent_pid = parent->pid; 270 + ev->event_data.coredump.parent_tgid = parent->tgid; 271 + } 272 + rcu_read_unlock(); 268 273 269 274 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 270 275 msg->ack = 0; /* not used */ ··· 283 276 { 284 277 struct cn_msg *msg; 285 278 struct proc_event *ev; 279 + struct task_struct *parent; 286 280 __u8 buffer[CN_PROC_MSG_SIZE] __aligned(8); 287 281 288 282 if (atomic_read(&proc_event_num_listeners) < 1) ··· 298 290 ev->event_data.exit.process_tgid = task->tgid; 299 291 ev->event_data.exit.exit_code = task->exit_code; 300 292 ev->event_data.exit.exit_signal = task->exit_signal; 301 - ev->event_data.exit.parent_pid = task->real_parent->pid; 302 - ev->event_data.exit.parent_tgid = task->real_parent->tgid; 293 + 294 + rcu_read_lock(); 295 + if (pid_alive(task)) { 296 + parent = rcu_dereference(task->real_parent); 297 + ev->event_data.exit.parent_pid = parent->pid; 298 + ev->event_data.exit.parent_tgid = parent->tgid; 299 + } 300 + rcu_read_unlock(); 303 301 304 302 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 305 303 msg->ack = 0; /* not used */
+4 -1
drivers/isdn/hardware/mISDN/mISDNinfineon.c
··· 712 712 (ulong)hw->addr.start, (ulong)hw->addr.size); 713 713 return err; 714 714 } 715 - if (hw->ci->addr_mode == AM_MEMIO) 715 + if (hw->ci->addr_mode == AM_MEMIO) { 716 716 hw->addr.p = ioremap(hw->addr.start, hw->addr.size); 717 + if (unlikely(!hw->addr.p)) 718 + return -ENOMEM; 719 + } 717 720 hw->addr.mode = hw->ci->addr_mode; 718 721 if (debug & DEBUG_HW) 719 722 pr_notice("%s: IO addr %lx (%lu bytes) mode%d\n",
+1 -1
drivers/isdn/isdnloop/isdnloop.c
··· 570 570 char buf[60]; 571 571 572 572 spin_lock_irqsave(&card->isdnloop_lock, flags); 573 - if (card->rcard) { 573 + if (card->rcard[ch]) { 574 574 isdnloop_fake(card->rcard[ch], "DDIS_I", card->rch[ch] + 1); 575 575 card->rcard[ch]->rcard[card->rch[ch]] = NULL; 576 576 card->rcard[ch] = NULL;
+1 -1
drivers/net/can/usb/peak_usb/pcan_usb_pro.c
··· 127 127 /* 128 128 * add one record to a message being built 129 129 */ 130 - static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, u8 id, ...) 130 + static int pcan_msg_add_rec(struct pcan_usb_pro_msg *pm, int id, ...) 131 131 { 132 132 int len, i; 133 133 u8 *pc;
+11
drivers/net/dsa/mv88e6xxx/chip.c
··· 569 569 goto restore_link; 570 570 } 571 571 572 + if (speed == SPEED_MAX && chip->info->ops->port_max_speed_mode) 573 + mode = chip->info->ops->port_max_speed_mode(port); 574 + 572 575 if (chip->info->ops->port_set_pause) { 573 576 err = chip->info->ops->port_set_pause(chip, port, pause); 574 577 if (err) ··· 3070 3067 .port_set_duplex = mv88e6xxx_port_set_duplex, 3071 3068 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3072 3069 .port_set_speed = mv88e6341_port_set_speed, 3070 + .port_max_speed_mode = mv88e6341_port_max_speed_mode, 3073 3071 .port_tag_remap = mv88e6095_port_tag_remap, 3074 3072 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3075 3073 .port_set_egress_floods = mv88e6352_port_set_egress_floods, ··· 3389 3385 .port_set_duplex = mv88e6xxx_port_set_duplex, 3390 3386 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3391 3387 .port_set_speed = mv88e6390_port_set_speed, 3388 + .port_max_speed_mode = mv88e6390_port_max_speed_mode, 3392 3389 .port_tag_remap = mv88e6390_port_tag_remap, 3393 3390 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3394 3391 .port_set_egress_floods = mv88e6352_port_set_egress_floods, ··· 3434 3429 .port_set_duplex = mv88e6xxx_port_set_duplex, 3435 3430 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3436 3431 .port_set_speed = mv88e6390x_port_set_speed, 3432 + .port_max_speed_mode = mv88e6390x_port_max_speed_mode, 3437 3433 .port_tag_remap = mv88e6390_port_tag_remap, 3438 3434 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3439 3435 .port_set_egress_floods = mv88e6352_port_set_egress_floods, ··· 3479 3473 .port_set_duplex = mv88e6xxx_port_set_duplex, 3480 3474 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3481 3475 .port_set_speed = mv88e6390_port_set_speed, 3476 + .port_max_speed_mode = mv88e6390_port_max_speed_mode, 3482 3477 .port_tag_remap = mv88e6390_port_tag_remap, 3483 3478 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3484 3479 .port_set_egress_floods = mv88e6352_port_set_egress_floods, ··· 3573 3566 .port_set_duplex = mv88e6xxx_port_set_duplex, 3574 3567 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3575 3568 .port_set_speed = mv88e6390_port_set_speed, 3569 + .port_max_speed_mode = mv88e6390_port_max_speed_mode, 3576 3570 .port_tag_remap = mv88e6390_port_tag_remap, 3577 3571 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3578 3572 .port_set_egress_floods = mv88e6352_port_set_egress_floods, ··· 3705 3697 .port_set_duplex = mv88e6xxx_port_set_duplex, 3706 3698 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3707 3699 .port_set_speed = mv88e6341_port_set_speed, 3700 + .port_max_speed_mode = mv88e6341_port_max_speed_mode, 3708 3701 .port_tag_remap = mv88e6095_port_tag_remap, 3709 3702 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3710 3703 .port_set_egress_floods = mv88e6352_port_set_egress_floods, ··· 3881 3872 .port_set_duplex = mv88e6xxx_port_set_duplex, 3882 3873 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3883 3874 .port_set_speed = mv88e6390_port_set_speed, 3875 + .port_max_speed_mode = mv88e6390_port_max_speed_mode, 3884 3876 .port_tag_remap = mv88e6390_port_tag_remap, 3885 3877 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3886 3878 .port_set_egress_floods = mv88e6352_port_set_egress_floods, ··· 3930 3920 .port_set_duplex = mv88e6xxx_port_set_duplex, 3931 3921 .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, 3932 3922 .port_set_speed = mv88e6390x_port_set_speed, 3923 + .port_max_speed_mode = mv88e6390x_port_max_speed_mode, 3933 3924 .port_tag_remap = mv88e6390_port_tag_remap, 3934 3925 .port_set_frame_mode = mv88e6351_port_set_frame_mode, 3935 3926 .port_set_egress_floods = mv88e6352_port_set_egress_floods,
+3
drivers/net/dsa/mv88e6xxx/chip.h
··· 377 377 */ 378 378 int (*port_set_speed)(struct mv88e6xxx_chip *chip, int port, int speed); 379 379 380 + /* What interface mode should be used for maximum speed? */ 381 + phy_interface_t (*port_max_speed_mode)(int port); 382 + 380 383 int (*port_tag_remap)(struct mv88e6xxx_chip *chip, int port); 381 384 382 385 int (*port_set_frame_mode)(struct mv88e6xxx_chip *chip, int port,
+24
drivers/net/dsa/mv88e6xxx/port.c
··· 312 312 return mv88e6xxx_port_set_speed(chip, port, speed, !port, true); 313 313 } 314 314 315 + phy_interface_t mv88e6341_port_max_speed_mode(int port) 316 + { 317 + if (port == 5) 318 + return PHY_INTERFACE_MODE_2500BASEX; 319 + 320 + return PHY_INTERFACE_MODE_NA; 321 + } 322 + 315 323 /* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */ 316 324 int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) 317 325 { ··· 353 345 return mv88e6xxx_port_set_speed(chip, port, speed, true, true); 354 346 } 355 347 348 + phy_interface_t mv88e6390_port_max_speed_mode(int port) 349 + { 350 + if (port == 9 || port == 10) 351 + return PHY_INTERFACE_MODE_2500BASEX; 352 + 353 + return PHY_INTERFACE_MODE_NA; 354 + } 355 + 356 356 /* Support 10, 100, 200, 1000, 2500, 10000 Mbps (e.g. 88E6190X) */ 357 357 int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) 358 358 { ··· 374 358 return -EOPNOTSUPP; 375 359 376 360 return mv88e6xxx_port_set_speed(chip, port, speed, true, true); 361 + } 362 + 363 + phy_interface_t mv88e6390x_port_max_speed_mode(int port) 364 + { 365 + if (port == 9 || port == 10) 366 + return PHY_INTERFACE_MODE_XAUI; 367 + 368 + return PHY_INTERFACE_MODE_NA; 377 369 } 378 370 379 371 int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
+4
drivers/net/dsa/mv88e6xxx/port.h
··· 285 285 int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); 286 286 int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); 287 287 288 + phy_interface_t mv88e6341_port_max_speed_mode(int port); 289 + phy_interface_t mv88e6390_port_max_speed_mode(int port); 290 + phy_interface_t mv88e6390x_port_max_speed_mode(int port); 291 + 288 292 int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state); 289 293 290 294 int mv88e6xxx_port_set_vlan_map(struct mv88e6xxx_chip *chip, int port, u16 map);
+3 -3
drivers/net/ethernet/cisco/enic/enic_main.c
··· 119 119 120 120 for (i = 0; i < enic->intr_count; i++) { 121 121 if (enic_is_err_intr(enic, i) || enic_is_notify_intr(enic, i) || 122 - (enic->msix[i].affinity_mask && 122 + (cpumask_available(enic->msix[i].affinity_mask) && 123 123 !cpumask_empty(enic->msix[i].affinity_mask))) 124 124 continue; 125 125 if (zalloc_cpumask_var(&enic->msix[i].affinity_mask, ··· 148 148 for (i = 0; i < enic->intr_count; i++) { 149 149 if (enic_is_err_intr(enic, i) || 150 150 enic_is_notify_intr(enic, i) || 151 - !enic->msix[i].affinity_mask || 151 + !cpumask_available(enic->msix[i].affinity_mask) || 152 152 cpumask_empty(enic->msix[i].affinity_mask)) 153 153 continue; 154 154 err = irq_set_affinity_hint(enic->msix_entry[i].vector, ··· 161 161 for (i = 0; i < enic->wq_count; i++) { 162 162 int wq_intr = enic_msix_wq_intr(enic, i); 163 163 164 - if (enic->msix[wq_intr].affinity_mask && 164 + if (cpumask_available(enic->msix[wq_intr].affinity_mask) && 165 165 !cpumask_empty(enic->msix[wq_intr].affinity_mask)) 166 166 netif_set_xps_queue(enic->netdev, 167 167 enic->msix[wq_intr].affinity_mask,
+1
drivers/net/ethernet/hisilicon/hns3/hnae3.h
··· 194 194 const struct hnae3_ae_ops *ops; 195 195 struct list_head node; 196 196 u32 flag; 197 + u8 override_pci_need_reset; /* fix to stop multiple reset happening */ 197 198 enum hnae3_dev_type dev_type; 198 199 enum hnae3_reset_type reset_type; 199 200 void *priv;
+7 -3
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
··· 1850 1850 1851 1851 /* request the reset */ 1852 1852 if (ae_dev->ops->reset_event) { 1853 - ae_dev->ops->reset_event(pdev, NULL); 1853 + if (!ae_dev->override_pci_need_reset) 1854 + ae_dev->ops->reset_event(pdev, NULL); 1855 + 1854 1856 return PCI_ERS_RESULT_RECOVERED; 1855 1857 } 1856 1858 ··· 2323 2321 if (!(bd_base_info & BIT(HNS3_RXD_L3L4P_B))) 2324 2322 return; 2325 2323 2326 - if (unlikely(l234info & (BIT(HNS3_RXD_L3E_B) | BIT(HNS3_RXD_L4E_B) || 2327 - BIT(HNS3_RXD_OL3E_B) || 2324 + if (unlikely(l234info & (BIT(HNS3_RXD_L3E_B) | BIT(HNS3_RXD_L4E_B) | 2325 + BIT(HNS3_RXD_OL3E_B) | 2328 2326 BIT(HNS3_RXD_OL4E_B)))) { 2329 2327 u64_stats_update_begin(&ring->syncp); 2330 2328 ring->stats.l3l4_csum_err++; ··· 2474 2472 desc = &ring->desc[ring->next_to_clean]; 2475 2473 desc_cb = &ring->desc_cb[ring->next_to_clean]; 2476 2474 bd_base_info = le32_to_cpu(desc->rx.bd_base_info); 2475 + /* make sure HW write desc complete */ 2476 + dma_rmb(); 2477 2477 if (!(bd_base_info & BIT(HNS3_RXD_VLD_B))) 2478 2478 return -ENXIO; 2479 2479
+7 -2
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_err.c
··· 1317 1317 hclge_handle_all_ras_errors(hdev); 1318 1318 } else { 1319 1319 if (test_bit(HCLGE_STATE_RST_HANDLING, &hdev->state) || 1320 - hdev->pdev->revision < 0x21) 1320 + hdev->pdev->revision < 0x21) { 1321 + ae_dev->override_pci_need_reset = 1; 1321 1322 return PCI_ERS_RESULT_RECOVERED; 1323 + } 1322 1324 } 1323 1325 1324 1326 if (status & HCLGE_RAS_REG_ROCEE_ERR_MASK) { ··· 1329 1327 } 1330 1328 1331 1329 if (status & HCLGE_RAS_REG_NFE_MASK || 1332 - status & HCLGE_RAS_REG_ROCEE_ERR_MASK) 1330 + status & HCLGE_RAS_REG_ROCEE_ERR_MASK) { 1331 + ae_dev->override_pci_need_reset = 0; 1333 1332 return PCI_ERS_RESULT_NEED_RESET; 1333 + } 1334 + ae_dev->override_pci_need_reset = 1; 1334 1335 1335 1336 return PCI_ERS_RESULT_RECOVERED; 1336 1337 }
+1 -1
drivers/net/ethernet/netronome/nfp/nfp_net_ctrl.h
··· 392 392 #define NFP_NET_CFG_MBOX_SIMPLE_CMD 0x0 393 393 #define NFP_NET_CFG_MBOX_SIMPLE_RET 0x4 394 394 #define NFP_NET_CFG_MBOX_SIMPLE_VAL 0x8 395 - #define NFP_NET_CFG_MBOX_SIMPLE_LEN 0x12 395 + #define NFP_NET_CFG_MBOX_SIMPLE_LEN 12 396 396 397 397 #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_ADD 1 398 398 #define NFP_NET_CFG_MBOX_CMD_CTAG_FILTER_KILL 2
+5 -2
drivers/net/ethernet/qlogic/qede/qede_ethtool.c
··· 1663 1663 /* Wait for loopback configuration to apply */ 1664 1664 msleep_interruptible(500); 1665 1665 1666 - /* prepare the loopback packet */ 1667 - pkt_size = edev->ndev->mtu + ETH_HLEN; 1666 + /* Setting max packet size to 1.5K to avoid data being split over 1667 + * multiple BDs in cases where MTU > PAGE_SIZE. 1668 + */ 1669 + pkt_size = (((edev->ndev->mtu < ETH_DATA_LEN) ? 1670 + edev->ndev->mtu : ETH_DATA_LEN) + ETH_HLEN); 1668 1671 1669 1672 skb = netdev_alloc_skb(edev->ndev, pkt_size); 1670 1673 if (!skb) {
+1
drivers/net/ethernet/realtek/8139too.c
··· 258 258 {0x126c, 0x1211, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, 259 259 {0x1743, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, 260 260 {0x021b, 0x8139, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, 261 + {0x16ec, 0xab06, PCI_ANY_ID, PCI_ANY_ID, 0, 0, RTL8139 }, 261 262 262 263 #ifdef CONFIG_SH_SECUREEDGE5410 263 264 /* Bogus 8139 silicon reports 8129 without external PROM :-( */
+1 -1
drivers/net/ethernet/renesas/ravb_main.c
··· 458 458 RCR_EFFS | RCR_ENCF | RCR_ETS0 | RCR_ESF | 0x18000000, RCR); 459 459 460 460 /* Set FIFO size */ 461 - ravb_write(ndev, TGC_TQP_AVBMODE1 | 0x00222200, TGC); 461 + ravb_write(ndev, TGC_TQP_AVBMODE1 | 0x00112200, TGC); 462 462 463 463 /* Timestamp enable */ 464 464 ravb_write(ndev, TCCR_TFEN, TCCR);
+114 -21
drivers/net/ethernet/stmicro/stmmac/dwmac-stm32.c
··· 25 25 26 26 #define SYSCFG_MCU_ETH_MASK BIT(23) 27 27 #define SYSCFG_MP1_ETH_MASK GENMASK(23, 16) 28 + #define SYSCFG_PMCCLRR_OFFSET 0x40 28 29 29 30 #define SYSCFG_PMCR_ETH_CLK_SEL BIT(16) 30 31 #define SYSCFG_PMCR_ETH_REF_CLK_SEL BIT(17) 32 + 33 + /* Ethernet PHY interface selection in register SYSCFG Configuration 34 + *------------------------------------------ 35 + * src |BIT(23)| BIT(22)| BIT(21)|BIT(20)| 36 + *------------------------------------------ 37 + * MII | 0 | 0 | 0 | 1 | 38 + *------------------------------------------ 39 + * GMII | 0 | 0 | 0 | 0 | 40 + *------------------------------------------ 41 + * RGMII | 0 | 0 | 1 | n/a | 42 + *------------------------------------------ 43 + * RMII | 1 | 0 | 0 | n/a | 44 + *------------------------------------------ 45 + */ 31 46 #define SYSCFG_PMCR_ETH_SEL_MII BIT(20) 32 47 #define SYSCFG_PMCR_ETH_SEL_RGMII BIT(21) 33 48 #define SYSCFG_PMCR_ETH_SEL_RMII BIT(23) ··· 50 35 #define SYSCFG_MCU_ETH_SEL_MII 0 51 36 #define SYSCFG_MCU_ETH_SEL_RMII 1 52 37 38 + /* STM32MP1 register definitions 39 + * 40 + * Below table summarizes the clock requirement and clock sources for 41 + * supported phy interface modes. 42 + * __________________________________________________________________________ 43 + *|PHY_MODE | Normal | PHY wo crystal| PHY wo crystal |No 125Mhz from PHY| 44 + *| | | 25MHz | 50MHz | | 45 + * --------------------------------------------------------------------------- 46 + *| MII | - | eth-ck | n/a | n/a | 47 + *| | | | | | 48 + * --------------------------------------------------------------------------- 49 + *| GMII | - | eth-ck | n/a | n/a | 50 + *| | | | | | 51 + * --------------------------------------------------------------------------- 52 + *| RGMII | - | eth-ck | n/a | eth-ck (no pin) | 53 + *| | | | | st,eth-clk-sel | 54 + * --------------------------------------------------------------------------- 55 + *| RMII | - | eth-ck | eth-ck | n/a | 56 + *| | | | st,eth-ref-clk-sel | | 57 + * --------------------------------------------------------------------------- 58 + * 59 + * BIT(17) : set this bit in RMII mode when you have PHY without crystal 50MHz 60 + * BIT(16) : set this bit in GMII/RGMII PHY when you do not want use 125Mhz 61 + * from PHY 62 + *----------------------------------------------------- 63 + * src | BIT(17) | BIT(16) | 64 + *----------------------------------------------------- 65 + * MII | n/a | n/a | 66 + *----------------------------------------------------- 67 + * GMII | n/a | st,eth-clk-sel | 68 + *----------------------------------------------------- 69 + * RGMII | n/a | st,eth-clk-sel | 70 + *----------------------------------------------------- 71 + * RMII | st,eth-ref-clk-sel | n/a | 72 + *----------------------------------------------------- 73 + * 74 + */ 75 + 53 76 struct stm32_dwmac { 54 77 struct clk *clk_tx; 55 78 struct clk *clk_rx; 56 79 struct clk *clk_eth_ck; 57 80 struct clk *clk_ethstp; 58 81 struct clk *syscfg_clk; 59 - bool int_phyclk; /* Clock from RCC to drive PHY */ 60 - u32 mode_reg; /* MAC glue-logic mode register */ 82 + int eth_clk_sel_reg; 83 + int eth_ref_clk_sel_reg; 84 + int irq_pwr_wakeup; 85 + u32 mode_reg; /* MAC glue-logic mode register */ 61 86 struct regmap *regmap; 62 87 u32 speed; 63 88 const struct stm32_ops *ops; ··· 157 102 if (ret) 158 103 return ret; 159 104 160 - if (dwmac->int_phyclk) { 105 + if (dwmac->clk_eth_ck) { 161 106 ret = clk_prepare_enable(dwmac->clk_eth_ck); 162 107 if (ret) { 163 108 clk_disable_unprepare(dwmac->syscfg_clk); ··· 166 111 } 167 112 } else { 168 113 clk_disable_unprepare(dwmac->syscfg_clk); 169 - if (dwmac->int_phyclk) 114 + if (dwmac->clk_eth_ck) 170 115 clk_disable_unprepare(dwmac->clk_eth_ck); 171 116 } 172 117 return ret; ··· 176 121 { 177 122 struct stm32_dwmac *dwmac = plat_dat->bsp_priv; 178 123 u32 reg = dwmac->mode_reg; 179 - int val; 124 + int val, ret; 180 125 181 126 switch (plat_dat->interface) { 182 127 case PHY_INTERFACE_MODE_MII: ··· 185 130 break; 186 131 case PHY_INTERFACE_MODE_GMII: 187 132 val = SYSCFG_PMCR_ETH_SEL_GMII; 188 - if (dwmac->int_phyclk) 133 + if (dwmac->eth_clk_sel_reg) 189 134 val |= SYSCFG_PMCR_ETH_CLK_SEL; 190 135 pr_debug("SYSCFG init : PHY_INTERFACE_MODE_GMII\n"); 191 136 break; 192 137 case PHY_INTERFACE_MODE_RMII: 193 138 val = SYSCFG_PMCR_ETH_SEL_RMII; 194 - if (dwmac->int_phyclk) 139 + if (dwmac->eth_ref_clk_sel_reg) 195 140 val |= SYSCFG_PMCR_ETH_REF_CLK_SEL; 196 141 pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RMII\n"); 197 142 break; 198 143 case PHY_INTERFACE_MODE_RGMII: 144 + case PHY_INTERFACE_MODE_RGMII_ID: 145 + case PHY_INTERFACE_MODE_RGMII_RXID: 146 + case PHY_INTERFACE_MODE_RGMII_TXID: 199 147 val = SYSCFG_PMCR_ETH_SEL_RGMII; 200 - if (dwmac->int_phyclk) 148 + if (dwmac->eth_clk_sel_reg) 201 149 val |= SYSCFG_PMCR_ETH_CLK_SEL; 202 150 pr_debug("SYSCFG init : PHY_INTERFACE_MODE_RGMII\n"); 203 151 break; ··· 211 153 return -EINVAL; 212 154 } 213 155 156 + /* Need to update PMCCLRR (clear register) */ 157 + ret = regmap_write(dwmac->regmap, reg + SYSCFG_PMCCLRR_OFFSET, 158 + dwmac->ops->syscfg_eth_mask); 159 + 160 + /* Update PMCSETR (set register) */ 214 161 return regmap_update_bits(dwmac->regmap, reg, 215 162 dwmac->ops->syscfg_eth_mask, val); 216 163 } ··· 243 180 } 244 181 245 182 return regmap_update_bits(dwmac->regmap, reg, 246 - dwmac->ops->syscfg_eth_mask, val); 183 + dwmac->ops->syscfg_eth_mask, val << 23); 247 184 } 248 185 249 186 static void stm32_dwmac_clk_disable(struct stm32_dwmac *dwmac) ··· 295 232 static int stm32mp1_parse_data(struct stm32_dwmac *dwmac, 296 233 struct device *dev) 297 234 { 235 + struct platform_device *pdev = to_platform_device(dev); 298 236 struct device_node *np = dev->of_node; 237 + int err = 0; 299 238 300 - dwmac->int_phyclk = of_property_read_bool(np, "st,int-phyclk"); 239 + /* Gigabit Ethernet 125MHz clock selection. */ 240 + dwmac->eth_clk_sel_reg = of_property_read_bool(np, "st,eth-clk-sel"); 301 241 302 - /* Check if internal clk from RCC selected */ 303 - if (dwmac->int_phyclk) { 304 - /* Get ETH_CLK clocks */ 305 - dwmac->clk_eth_ck = devm_clk_get(dev, "eth-ck"); 306 - if (IS_ERR(dwmac->clk_eth_ck)) { 307 - dev_err(dev, "No ETH CK clock provided...\n"); 308 - return PTR_ERR(dwmac->clk_eth_ck); 309 - } 242 + /* Ethernet 50Mhz RMII clock selection */ 243 + dwmac->eth_ref_clk_sel_reg = 244 + of_property_read_bool(np, "st,eth-ref-clk-sel"); 245 + 246 + /* Get ETH_CLK clocks */ 247 + dwmac->clk_eth_ck = devm_clk_get(dev, "eth-ck"); 248 + if (IS_ERR(dwmac->clk_eth_ck)) { 249 + dev_warn(dev, "No phy clock provided...\n"); 250 + dwmac->clk_eth_ck = NULL; 310 251 } 311 252 312 253 /* Clock used for low power mode */ 313 254 dwmac->clk_ethstp = devm_clk_get(dev, "ethstp"); 314 255 if (IS_ERR(dwmac->clk_ethstp)) { 315 - dev_err(dev, "No ETH peripheral clock provided for CStop mode ...\n"); 256 + dev_err(dev, 257 + "No ETH peripheral clock provided for CStop mode ...\n"); 316 258 return PTR_ERR(dwmac->clk_ethstp); 317 259 } 318 260 ··· 328 260 return PTR_ERR(dwmac->syscfg_clk); 329 261 } 330 262 331 - return 0; 263 + /* Get IRQ information early to have an ability to ask for deferred 264 + * probe if needed before we went too far with resource allocation. 265 + */ 266 + dwmac->irq_pwr_wakeup = platform_get_irq_byname(pdev, 267 + "stm32_pwr_wakeup"); 268 + if (!dwmac->clk_eth_ck && dwmac->irq_pwr_wakeup >= 0) { 269 + err = device_init_wakeup(&pdev->dev, true); 270 + if (err) { 271 + dev_err(&pdev->dev, "Failed to init wake up irq\n"); 272 + return err; 273 + } 274 + err = dev_pm_set_dedicated_wake_irq(&pdev->dev, 275 + dwmac->irq_pwr_wakeup); 276 + if (err) { 277 + dev_err(&pdev->dev, "Failed to set wake up irq\n"); 278 + device_init_wakeup(&pdev->dev, false); 279 + } 280 + device_set_wakeup_enable(&pdev->dev, false); 281 + } 282 + return err; 332 283 } 333 284 334 285 static int stm32_dwmac_probe(struct platform_device *pdev) ··· 413 326 struct net_device *ndev = platform_get_drvdata(pdev); 414 327 struct stmmac_priv *priv = netdev_priv(ndev); 415 328 int ret = stmmac_dvr_remove(&pdev->dev); 329 + struct stm32_dwmac *dwmac = priv->plat->bsp_priv; 416 330 417 331 stm32_dwmac_clk_disable(priv->plat->bsp_priv); 332 + 333 + if (dwmac->irq_pwr_wakeup >= 0) { 334 + dev_pm_clear_wake_irq(&pdev->dev); 335 + device_init_wakeup(&pdev->dev, false); 336 + } 418 337 419 338 return ret; 420 339 } ··· 435 342 436 343 clk_disable_unprepare(dwmac->clk_tx); 437 344 clk_disable_unprepare(dwmac->syscfg_clk); 438 - if (dwmac->int_phyclk) 345 + if (dwmac->clk_eth_ck) 439 346 clk_disable_unprepare(dwmac->clk_eth_ck); 440 347 441 348 return ret;
+3 -3
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 480 480 struct dma_desc *p, struct sk_buff *skb) 481 481 { 482 482 struct skb_shared_hwtstamps shhwtstamp; 483 - u64 ns; 483 + u64 ns = 0; 484 484 485 485 if (!priv->hwts_tx_en) 486 486 return; ··· 519 519 { 520 520 struct skb_shared_hwtstamps *shhwtstamp = NULL; 521 521 struct dma_desc *desc = p; 522 - u64 ns; 522 + u64 ns = 0; 523 523 524 524 if (!priv->hwts_rx_en) 525 525 return; ··· 564 564 u32 snap_type_sel = 0; 565 565 u32 ts_master_en = 0; 566 566 u32 ts_event_en = 0; 567 + u32 sec_inc = 0; 567 568 u32 value = 0; 568 - u32 sec_inc; 569 569 bool xmac; 570 570 571 571 xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac;
+3
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
··· 408 408 /* Default to phy auto-detection */ 409 409 plat->phy_addr = -1; 410 410 411 + /* Get clk_csr from device tree */ 412 + of_property_read_u32(np, "clk_csr", &plat->clk_csr); 413 + 411 414 /* "snps,phy-addr" is not a standard property. Mark it as deprecated 412 415 * and warn of its use. Remove this when phy node support is added. 413 416 */
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
··· 105 105 struct stmmac_priv *priv = 106 106 container_of(ptp, struct stmmac_priv, ptp_clock_ops); 107 107 unsigned long flags; 108 - u64 ns; 108 + u64 ns = 0; 109 109 110 110 spin_lock_irqsave(&priv->ptp_lock, flags); 111 111 stmmac_get_systime(priv, priv->ptpaddr, &ns);
+1
drivers/net/ethernet/sun/niu.c
··· 7464 7464 class = CLASS_CODE_USER_PROG4; 7465 7465 break; 7466 7466 default: 7467 + class = CLASS_CODE_UNRECOG; 7467 7468 break; 7468 7469 } 7469 7470 ret = tcam_user_ip_class_set(np, class, 0,
+1 -3
drivers/net/ethernet/ti/davinci_emac.c
··· 2029 2029 .resume = davinci_emac_resume, 2030 2030 }; 2031 2031 2032 - #if IS_ENABLED(CONFIG_OF) 2033 2032 static const struct emac_platform_data am3517_emac_data = { 2034 2033 .version = EMAC_VERSION_2, 2035 2034 .hw_ram_addr = 0x01e20000, ··· 2045 2046 {}, 2046 2047 }; 2047 2048 MODULE_DEVICE_TABLE(of, davinci_emac_of_match); 2048 - #endif 2049 2049 2050 2050 /* davinci_emac_driver: EMAC platform driver structure */ 2051 2051 static struct platform_driver davinci_emac_driver = { 2052 2052 .driver = { 2053 2053 .name = "davinci_emac", 2054 2054 .pm = &davinci_emac_pm_ops, 2055 - .of_match_table = of_match_ptr(davinci_emac_of_match), 2055 + .of_match_table = davinci_emac_of_match, 2056 2056 }, 2057 2057 .probe = davinci_emac_probe, 2058 2058 .remove = davinci_emac_remove,
+15 -3
drivers/net/vxlan.c
··· 1731 1731 goto drop; 1732 1732 } 1733 1733 1734 + rcu_read_lock(); 1735 + 1736 + if (unlikely(!(vxlan->dev->flags & IFF_UP))) { 1737 + rcu_read_unlock(); 1738 + atomic_long_inc(&vxlan->dev->rx_dropped); 1739 + goto drop; 1740 + } 1741 + 1734 1742 stats = this_cpu_ptr(vxlan->dev->tstats); 1735 1743 u64_stats_update_begin(&stats->syncp); 1736 1744 stats->rx_packets++; ··· 1746 1738 u64_stats_update_end(&stats->syncp); 1747 1739 1748 1740 gro_cells_receive(&vxlan->gro_cells, skb); 1741 + 1742 + rcu_read_unlock(); 1743 + 1749 1744 return 0; 1750 1745 1751 1746 drop: ··· 2701 2690 for (h = 0; h < FDB_HASH_SIZE; ++h) { 2702 2691 struct hlist_node *p, *n; 2703 2692 2704 - spin_lock_bh(&vxlan->hash_lock); 2693 + spin_lock(&vxlan->hash_lock); 2705 2694 hlist_for_each_safe(p, n, &vxlan->fdb_head[h]) { 2706 2695 struct vxlan_fdb *f 2707 2696 = container_of(p, struct vxlan_fdb, hlist); ··· 2723 2712 } else if (time_before(timeout, next_timer)) 2724 2713 next_timer = timeout; 2725 2714 } 2726 - spin_unlock_bh(&vxlan->hash_lock); 2715 + spin_unlock(&vxlan->hash_lock); 2727 2716 } 2728 2717 2729 2718 mod_timer(&vxlan->age_timer, next_timer); ··· 2777 2766 static void vxlan_uninit(struct net_device *dev) 2778 2767 { 2779 2768 struct vxlan_dev *vxlan = netdev_priv(dev); 2769 + 2770 + gro_cells_destroy(&vxlan->gro_cells); 2780 2771 2781 2772 vxlan_fdb_delete_default(vxlan, vxlan->cfg.vni); 2782 2773 ··· 3955 3942 3956 3943 vxlan_flush(vxlan, true); 3957 3944 3958 - gro_cells_destroy(&vxlan->gro_cells); 3959 3945 list_del(&vxlan->next); 3960 3946 unregister_netdevice_queue(dev, head); 3961 3947 }
+14 -4
include/linux/atalk.h
··· 161 161 extern int atalk_register_sysctl(void); 162 162 extern void atalk_unregister_sysctl(void); 163 163 #else 164 - #define atalk_register_sysctl() do { } while(0) 165 - #define atalk_unregister_sysctl() do { } while(0) 164 + static inline int atalk_register_sysctl(void) 165 + { 166 + return 0; 167 + } 168 + static inline void atalk_unregister_sysctl(void) 169 + { 170 + } 166 171 #endif 167 172 168 173 #ifdef CONFIG_PROC_FS 169 174 extern int atalk_proc_init(void); 170 175 extern void atalk_proc_exit(void); 171 176 #else 172 - #define atalk_proc_init() ({ 0; }) 173 - #define atalk_proc_exit() do { } while(0) 177 + static inline int atalk_proc_init(void) 178 + { 179 + return 0; 180 + } 181 + static inline void atalk_proc_exit(void) 182 + { 183 + } 174 184 #endif /* CONFIG_PROC_FS */ 175 185 176 186 #endif /* __LINUX_ATALK_H__ */
+1 -1
include/linux/bpf-cgroup.h
··· 292 292 static inline void bpf_cgroup_storage_release(struct bpf_prog *prog, 293 293 struct bpf_map *map) {} 294 294 static inline struct bpf_cgroup_storage *bpf_cgroup_storage_alloc( 295 - struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return 0; } 295 + struct bpf_prog *prog, enum bpf_cgroup_storage_type stype) { return NULL; } 296 296 static inline void bpf_cgroup_storage_free( 297 297 struct bpf_cgroup_storage *storage) {} 298 298 static inline int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key,
+1 -1
include/linux/igmp.h
··· 110 110 static inline int ip_mc_may_pull(struct sk_buff *skb, unsigned int len) 111 111 { 112 112 if (skb_transport_offset(skb) + ip_transport_len(skb) < len) 113 - return -EINVAL; 113 + return 0; 114 114 115 115 return pskb_may_pull(skb, len); 116 116 }
+61 -7
include/linux/skbuff.h
··· 327 327 #endif 328 328 }; 329 329 330 + /** 331 + * skb_frag_size - Returns the size of a skb fragment 332 + * @frag: skb fragment 333 + */ 330 334 static inline unsigned int skb_frag_size(const skb_frag_t *frag) 331 335 { 332 336 return frag->size; 333 337 } 334 338 339 + /** 340 + * skb_frag_size_set - Sets the size of a skb fragment 341 + * @frag: skb fragment 342 + * @size: size of fragment 343 + */ 335 344 static inline void skb_frag_size_set(skb_frag_t *frag, unsigned int size) 336 345 { 337 346 frag->size = size; 338 347 } 339 348 349 + /** 350 + * skb_frag_size_add - Incrementes the size of a skb fragment by %delta 351 + * @frag: skb fragment 352 + * @delta: value to add 353 + */ 340 354 static inline void skb_frag_size_add(skb_frag_t *frag, int delta) 341 355 { 342 356 frag->size += delta; 343 357 } 344 358 359 + /** 360 + * skb_frag_size_sub - Decrements the size of a skb fragment by %delta 361 + * @frag: skb fragment 362 + * @delta: value to subtract 363 + */ 345 364 static inline void skb_frag_size_sub(skb_frag_t *frag, int delta) 346 365 { 347 366 frag->size -= delta; 348 367 } 349 368 369 + /** 370 + * skb_frag_must_loop - Test if %p is a high memory page 371 + * @p: fragment's page 372 + */ 350 373 static inline bool skb_frag_must_loop(struct page *p) 351 374 { 352 375 #if defined(CONFIG_HIGHMEM) ··· 613 590 typedef unsigned char *sk_buff_data_t; 614 591 #endif 615 592 616 - /** 593 + /** 617 594 * struct sk_buff - socket buffer 618 595 * @next: Next buffer in list 619 596 * @prev: Previous buffer in list ··· 671 648 * @csum_not_inet: use CRC32c to resolve CHECKSUM_PARTIAL 672 649 * @dst_pending_confirm: need to confirm neighbour 673 650 * @decrypted: Decrypted SKB 674 - * @napi_id: id of the NAPI struct this skb came from 651 + * @napi_id: id of the NAPI struct this skb came from 675 652 * @secmark: security marking 676 653 * @mark: Generic packet mark 677 654 * @vlan_proto: vlan encapsulation protocol ··· 906 883 #define SKB_ALLOC_RX 0x02 907 884 #define SKB_ALLOC_NAPI 0x04 908 885 909 - /* Returns true if the skb was allocated from PFMEMALLOC reserves */ 886 + /** 887 + * skb_pfmemalloc - Test if the skb was allocated from PFMEMALLOC reserves 888 + * @skb: buffer 889 + */ 910 890 static inline bool skb_pfmemalloc(const struct sk_buff *skb) 911 891 { 912 892 return unlikely(skb->pfmemalloc); ··· 931 905 */ 932 906 static inline struct dst_entry *skb_dst(const struct sk_buff *skb) 933 907 { 934 - /* If refdst was not refcounted, check we still are in a 908 + /* If refdst was not refcounted, check we still are in a 935 909 * rcu_read_lock section 936 910 */ 937 911 WARN_ON((skb->_skb_refdst & SKB_DST_NOREF) && ··· 978 952 return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb); 979 953 } 980 954 955 + /** 956 + * skb_rtable - Returns the skb &rtable 957 + * @skb: buffer 958 + */ 981 959 static inline struct rtable *skb_rtable(const struct sk_buff *skb) 982 960 { 983 961 return (struct rtable *)skb_dst(skb); ··· 996 966 return ptype <= PACKET_OTHERHOST; 997 967 } 998 968 969 + /** 970 + * skb_napi_id - Returns the skb's NAPI id 971 + * @skb: buffer 972 + */ 999 973 static inline unsigned int skb_napi_id(const struct sk_buff *skb) 1000 974 { 1001 975 #ifdef CONFIG_NET_RX_BUSY_POLL ··· 1009 975 #endif 1010 976 } 1011 977 1012 - /* decrement the reference count and return true if we can free the skb */ 978 + /** 979 + * skb_unref - decrement the skb's reference count 980 + * @skb: buffer 981 + * 982 + * Returns true if we can free the skb. 983 + */ 1013 984 static inline bool skb_unref(struct sk_buff *skb) 1014 985 { 1015 986 if (unlikely(!skb)) ··· 1044 1005 int node); 1045 1006 struct sk_buff *__build_skb(void *data, unsigned int frag_size); 1046 1007 struct sk_buff *build_skb(void *data, unsigned int frag_size); 1008 + 1009 + /** 1010 + * alloc_skb - allocate a network buffer 1011 + * @size: size to allocate 1012 + * @priority: allocation mask 1013 + * 1014 + * This function is a convenient wrapper around __alloc_skb(). 1015 + */ 1047 1016 static inline struct sk_buff *alloc_skb(unsigned int size, 1048 1017 gfp_t priority) 1049 1018 { ··· 1094 1047 fclones->skb2.sk == sk; 1095 1048 } 1096 1049 1050 + /** 1051 + * alloc_skb_fclone - allocate a network buffer from fclone cache 1052 + * @size: size to allocate 1053 + * @priority: allocation mask 1054 + * 1055 + * This function is a convenient wrapper around __alloc_skb(). 1056 + */ 1097 1057 static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 1098 1058 gfp_t priority) 1099 1059 { ··· 4286 4232 return skb_shinfo(skb)->gso_type & SKB_GSO_SCTP; 4287 4233 } 4288 4234 4235 + /* Note: Should be called only if skb_is_gso(skb) is true */ 4289 4236 static inline bool skb_is_gso_tcp(const struct sk_buff *skb) 4290 4237 { 4291 - return skb_is_gso(skb) && 4292 - skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); 4238 + return skb_shinfo(skb)->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6); 4293 4239 } 4294 4240 4295 4241 static inline void skb_gso_reset(struct sk_buff *skb)
-1
include/net/request_sock.h
··· 108 108 109 109 static inline void reqsk_free(struct request_sock *req) 110 110 { 111 - /* temporary debugging */ 112 111 WARN_ON_ONCE(refcount_read(&req->rsk_refcnt) != 0); 113 112 114 113 req->rsk_ops->destructor(req);
+2
include/trace/events/rxrpc.h
··· 76 76 rxrpc_client_chan_disconnect, 77 77 rxrpc_client_chan_pass, 78 78 rxrpc_client_chan_unstarted, 79 + rxrpc_client_chan_wait_failed, 79 80 rxrpc_client_cleanup, 80 81 rxrpc_client_count, 81 82 rxrpc_client_discard, ··· 277 276 EM(rxrpc_client_chan_disconnect, "ChDisc") \ 278 277 EM(rxrpc_client_chan_pass, "ChPass") \ 279 278 EM(rxrpc_client_chan_unstarted, "ChUnst") \ 279 + EM(rxrpc_client_chan_wait_failed, "ChWtFl") \ 280 280 EM(rxrpc_client_cleanup, "Clean ") \ 281 281 EM(rxrpc_client_count, "Count ") \ 282 282 EM(rxrpc_client_discard, "Discar") \
+5 -5
kernel/bpf/verifier.c
··· 6678 6678 /* valid generic load 64-bit imm */ 6679 6679 goto next_insn; 6680 6680 6681 - if (insn->src_reg != BPF_PSEUDO_MAP_FD) { 6682 - verbose(env, 6683 - "unrecognized bpf_ld_imm64 insn\n"); 6681 + if (insn[0].src_reg != BPF_PSEUDO_MAP_FD || 6682 + insn[1].imm != 0) { 6683 + verbose(env, "unrecognized bpf_ld_imm64 insn\n"); 6684 6684 return -EINVAL; 6685 6685 } 6686 6686 6687 - f = fdget(insn->imm); 6687 + f = fdget(insn[0].imm); 6688 6688 map = __bpf_map_get(f); 6689 6689 if (IS_ERR(map)) { 6690 6690 verbose(env, "fd %d is not pointing to valid bpf_map\n", 6691 - insn->imm); 6691 + insn[0].imm); 6692 6692 return PTR_ERR(map); 6693 6693 } 6694 6694
+1 -1
kernel/sysctl.c
··· 3326 3326 3327 3327 #endif /* CONFIG_PROC_SYSCTL */ 3328 3328 3329 - #ifdef CONFIG_BPF_SYSCALL 3329 + #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_SYSCTL) 3330 3330 static int proc_dointvec_minmax_bpf_stats(struct ctl_table *table, int write, 3331 3331 void __user *buffer, size_t *lenp, 3332 3332 loff_t *ppos)
+3 -7
net/atm/resources.c
··· 203 203 int __user *sioc_len; 204 204 int __user *iobuf_len; 205 205 206 - #ifndef CONFIG_COMPAT 207 - compat = 0; /* Just so the compiler _knows_ */ 208 - #endif 209 - 210 206 switch (cmd) { 211 207 case ATM_GETNAMES: 212 - if (compat) { 208 + if (IS_ENABLED(CONFIG_COMPAT) && compat) { 213 209 #ifdef CONFIG_COMPAT 214 210 struct compat_atm_iobuf __user *ciobuf = arg; 215 211 compat_uptr_t cbuf; ··· 249 253 break; 250 254 } 251 255 252 - if (compat) { 256 + if (IS_ENABLED(CONFIG_COMPAT) && compat) { 253 257 #ifdef CONFIG_COMPAT 254 258 struct compat_atmif_sioc __user *csioc = arg; 255 259 compat_uptr_t carg; ··· 413 417 } 414 418 /* fall through */ 415 419 default: 416 - if (compat) { 420 + if (IS_ENABLED(CONFIG_COMPAT) && compat) { 417 421 #ifdef CONFIG_COMPAT 418 422 if (!dev->ops->compat_ioctl) { 419 423 error = -EINVAL;
+1 -1
net/bpf/test_run.c
··· 16 16 static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat, 17 17 u32 *retval, u32 *time) 18 18 { 19 - struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { 0 }; 19 + struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL }; 20 20 enum bpf_cgroup_storage_type stype; 21 21 u64 time_start, time_spent = 0; 22 22 int ret = 0;
+9 -7
net/core/ethtool.c
··· 2319 2319 return ret; 2320 2320 } 2321 2321 2322 - static int ethtool_get_per_queue_coalesce(struct net_device *dev, 2323 - void __user *useraddr, 2324 - struct ethtool_per_queue_op *per_queue_opt) 2322 + static noinline_for_stack int 2323 + ethtool_get_per_queue_coalesce(struct net_device *dev, 2324 + void __user *useraddr, 2325 + struct ethtool_per_queue_op *per_queue_opt) 2325 2326 { 2326 2327 u32 bit; 2327 2328 int ret; ··· 2350 2349 return 0; 2351 2350 } 2352 2351 2353 - static int ethtool_set_per_queue_coalesce(struct net_device *dev, 2354 - void __user *useraddr, 2355 - struct ethtool_per_queue_op *per_queue_opt) 2352 + static noinline_for_stack int 2353 + ethtool_set_per_queue_coalesce(struct net_device *dev, 2354 + void __user *useraddr, 2355 + struct ethtool_per_queue_op *per_queue_opt) 2356 2356 { 2357 2357 u32 bit; 2358 2358 int i, ret = 0; ··· 2407 2405 return ret; 2408 2406 } 2409 2407 2410 - static int ethtool_set_per_queue(struct net_device *dev, 2408 + static int noinline_for_stack ethtool_set_per_queue(struct net_device *dev, 2411 2409 void __user *useraddr, u32 sub_cmd) 2412 2410 { 2413 2411 struct ethtool_per_queue_op per_queue_opt;
+4 -4
net/core/filter.c
··· 2804 2804 u32 off = skb_mac_header_len(skb); 2805 2805 int ret; 2806 2806 2807 - if (!skb_is_gso_tcp(skb)) 2807 + if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) 2808 2808 return -ENOTSUPP; 2809 2809 2810 2810 ret = skb_cow(skb, len_diff); ··· 2845 2845 u32 off = skb_mac_header_len(skb); 2846 2846 int ret; 2847 2847 2848 - if (!skb_is_gso_tcp(skb)) 2848 + if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) 2849 2849 return -ENOTSUPP; 2850 2850 2851 2851 ret = skb_unclone(skb, GFP_ATOMIC); ··· 2970 2970 u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); 2971 2971 int ret; 2972 2972 2973 - if (!skb_is_gso_tcp(skb)) 2973 + if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) 2974 2974 return -ENOTSUPP; 2975 2975 2976 2976 ret = skb_cow(skb, len_diff); ··· 2999 2999 u32 off = skb_mac_header_len(skb) + bpf_skb_net_base_len(skb); 3000 3000 int ret; 3001 3001 3002 - if (!skb_is_gso_tcp(skb)) 3002 + if (skb_is_gso(skb) && !skb_is_gso_tcp(skb)) 3003 3003 return -ENOTSUPP; 3004 3004 3005 3005 ret = skb_unclone(skb, GFP_ATOMIC);
+18 -4
net/core/gro_cells.c
··· 13 13 { 14 14 struct net_device *dev = skb->dev; 15 15 struct gro_cell *cell; 16 + int res; 16 17 17 - if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) 18 - return netif_rx(skb); 18 + rcu_read_lock(); 19 + if (unlikely(!(dev->flags & IFF_UP))) 20 + goto drop; 21 + 22 + if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) { 23 + res = netif_rx(skb); 24 + goto unlock; 25 + } 19 26 20 27 cell = this_cpu_ptr(gcells->cells); 21 28 22 29 if (skb_queue_len(&cell->napi_skbs) > netdev_max_backlog) { 30 + drop: 23 31 atomic_long_inc(&dev->rx_dropped); 24 32 kfree_skb(skb); 25 - return NET_RX_DROP; 33 + res = NET_RX_DROP; 34 + goto unlock; 26 35 } 27 36 28 37 __skb_queue_tail(&cell->napi_skbs, skb); 29 38 if (skb_queue_len(&cell->napi_skbs) == 1) 30 39 napi_schedule(&cell->napi); 31 - return NET_RX_SUCCESS; 40 + 41 + res = NET_RX_SUCCESS; 42 + 43 + unlock: 44 + rcu_read_unlock(); 45 + return res; 32 46 } 33 47 EXPORT_SYMBOL(gro_cells_receive); 34 48
+2
net/core/lwt_bpf.c
··· 625 625 626 626 /* push the encap headers and fix pointers */ 627 627 skb_reset_inner_headers(skb); 628 + skb_reset_inner_mac_header(skb); /* mac header is not yet set */ 629 + skb_set_inner_protocol(skb, skb->protocol); 628 630 skb->encapsulation = 1; 629 631 skb_push(skb, len); 630 632 if (ingress)
+1
net/core/skmsg.c
··· 554 554 struct sk_psock *psock = container_of(gc, struct sk_psock, gc); 555 555 556 556 /* No sk_callback_lock since already detached. */ 557 + strp_stop(&psock->parser.strp); 557 558 strp_done(&psock->parser.strp); 558 559 559 560 cancel_work_sync(&psock->work);
+9 -9
net/hsr/hsr_device.c
··· 94 94 && (old_operstate != IF_OPER_UP)) { 95 95 /* Went up */ 96 96 hsr->announce_count = 0; 97 - hsr->announce_timer.expires = jiffies + 98 - msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL); 99 - add_timer(&hsr->announce_timer); 97 + mod_timer(&hsr->announce_timer, 98 + jiffies + msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL)); 100 99 } 101 100 102 101 if ((hsr_dev->operstate != IF_OPER_UP) && (old_operstate == IF_OPER_UP)) ··· 331 332 { 332 333 struct hsr_priv *hsr; 333 334 struct hsr_port *master; 335 + unsigned long interval; 334 336 335 337 hsr = from_timer(hsr, t, announce_timer); 336 338 ··· 343 343 hsr->protVersion); 344 344 hsr->announce_count++; 345 345 346 - hsr->announce_timer.expires = jiffies + 347 - msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL); 346 + interval = msecs_to_jiffies(HSR_ANNOUNCE_INTERVAL); 348 347 } else { 349 348 send_hsr_supervision_frame(master, HSR_TLV_LIFE_CHECK, 350 349 hsr->protVersion); 351 350 352 - hsr->announce_timer.expires = jiffies + 353 - msecs_to_jiffies(HSR_LIFE_CHECK_INTERVAL); 351 + interval = msecs_to_jiffies(HSR_LIFE_CHECK_INTERVAL); 354 352 } 355 353 356 354 if (is_admin_up(master->dev)) 357 - add_timer(&hsr->announce_timer); 355 + mod_timer(&hsr->announce_timer, jiffies + interval); 358 356 359 357 rcu_read_unlock(); 360 358 } ··· 484 486 485 487 res = hsr_add_port(hsr, hsr_dev, HSR_PT_MASTER); 486 488 if (res) 487 - return res; 489 + goto err_add_port; 488 490 489 491 res = register_netdevice(hsr_dev); 490 492 if (res) ··· 504 506 fail: 505 507 hsr_for_each_port(hsr, port) 506 508 hsr_del_port(port); 509 + err_add_port: 510 + hsr_del_node(&hsr->self_node_db); 507 511 508 512 return res; 509 513 }
+12
net/hsr/hsr_framereg.c
··· 124 124 return 0; 125 125 } 126 126 127 + void hsr_del_node(struct list_head *self_node_db) 128 + { 129 + struct hsr_node *node; 130 + 131 + rcu_read_lock(); 132 + node = list_first_or_null_rcu(self_node_db, struct hsr_node, mac_list); 133 + rcu_read_unlock(); 134 + if (node) { 135 + list_del_rcu(&node->mac_list); 136 + kfree(node); 137 + } 138 + } 127 139 128 140 /* Allocate an hsr_node and add it to node_db. 'addr' is the node's AddressA; 129 141 * seq_out is used to initialize filtering of outgoing duplicate frames
+1
net/hsr/hsr_framereg.h
··· 16 16 17 17 struct hsr_node; 18 18 19 + void hsr_del_node(struct list_head *self_node_db); 19 20 struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], 20 21 u16 seq_out); 21 22 struct hsr_node *hsr_get_node(struct hsr_port *port, struct sk_buff *skb,
+2 -2
net/ipv4/fou.c
··· 1024 1024 int ret; 1025 1025 1026 1026 len = sizeof(struct udphdr) + sizeof(struct guehdr); 1027 - if (!pskb_may_pull(skb, len)) 1027 + if (!pskb_may_pull(skb, transport_offset + len)) 1028 1028 return -EINVAL; 1029 1029 1030 1030 guehdr = (struct guehdr *)&udp_hdr(skb)[1]; ··· 1059 1059 1060 1060 optlen = guehdr->hlen << 2; 1061 1061 1062 - if (!pskb_may_pull(skb, len + optlen)) 1062 + if (!pskb_may_pull(skb, transport_offset + len + optlen)) 1063 1063 return -EINVAL; 1064 1064 1065 1065 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
+6 -3
net/ipv4/ip_tunnel.c
··· 515 515 mtu = dst_mtu(&rt->dst) - dev->hard_header_len 516 516 - sizeof(struct iphdr) - tunnel_hlen; 517 517 else 518 - mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; 518 + mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu; 519 519 520 - skb_dst_update_pmtu(skb, mtu); 520 + if (skb_valid_dst(skb)) 521 + skb_dst_update_pmtu(skb, mtu); 521 522 522 523 if (skb->protocol == htons(ETH_P_IP)) { 523 524 if (!skb_is_gso(skb) && ··· 531 530 } 532 531 #if IS_ENABLED(CONFIG_IPV6) 533 532 else if (skb->protocol == htons(ETH_P_IPV6)) { 534 - struct rt6_info *rt6 = (struct rt6_info *)skb_dst(skb); 533 + struct rt6_info *rt6; 535 534 __be32 daddr; 536 535 536 + rt6 = skb_valid_dst(skb) ? (struct rt6_info *)skb_dst(skb) : 537 + NULL; 537 538 daddr = md ? dst : tunnel->parms.iph.daddr; 538 539 539 540 if (rt6 && mtu < dst_mtu(skb_dst(skb)) &&
+9 -4
net/ipv4/route.c
··· 1303 1303 if (fnhe->fnhe_daddr == daddr) { 1304 1304 rcu_assign_pointer(*fnhe_p, rcu_dereference_protected( 1305 1305 fnhe->fnhe_next, lockdep_is_held(&fnhe_lock))); 1306 + /* set fnhe_daddr to 0 to ensure it won't bind with 1307 + * new dsts in rt_bind_exception(). 1308 + */ 1309 + fnhe->fnhe_daddr = 0; 1306 1310 fnhe_flush_routes(fnhe); 1307 1311 kfree_rcu(fnhe, rcu); 1308 1312 break; ··· 2153 2149 int our = 0; 2154 2150 int err = -EINVAL; 2155 2151 2156 - if (in_dev) 2157 - our = ip_check_mc_rcu(in_dev, daddr, saddr, 2158 - ip_hdr(skb)->protocol); 2152 + if (!in_dev) 2153 + return err; 2154 + our = ip_check_mc_rcu(in_dev, daddr, saddr, 2155 + ip_hdr(skb)->protocol); 2159 2156 2160 2157 /* check l3 master if no match yet */ 2161 - if ((!in_dev || !our) && netif_is_l3_slave(dev)) { 2158 + if (!our && netif_is_l3_slave(dev)) { 2162 2159 struct in_device *l3_in_dev; 2163 2160 2164 2161 l3_in_dev = __in_dev_get_rcu(skb->dev);
+6 -1
net/ipv4/syncookies.c
··· 216 216 refcount_set(&req->rsk_refcnt, 1); 217 217 tcp_sk(child)->tsoffset = tsoff; 218 218 sock_rps_save_rxhash(child, skb); 219 - inet_csk_reqsk_queue_add(sk, req, child); 219 + if (!inet_csk_reqsk_queue_add(sk, req, child)) { 220 + bh_unlock_sock(child); 221 + sock_put(child); 222 + child = NULL; 223 + reqsk_put(req); 224 + } 220 225 } else { 221 226 reqsk_free(req); 222 227 }
+9
net/ipv4/tcp.c
··· 943 943 ssize_t copied; 944 944 long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); 945 945 946 + if (IS_ENABLED(CONFIG_DEBUG_VM) && 947 + WARN_ONCE(PageSlab(page), "page must not be a Slab one")) 948 + return -EINVAL; 949 + 946 950 /* Wait for a connection to finish. One exception is TCP Fast Open 947 951 * (passive side) where data is allowed to be sent before a connection 948 952 * is fully established. ··· 1937 1933 inq = tp->rcv_nxt - tp->copied_seq; 1938 1934 release_sock(sk); 1939 1935 } 1936 + /* After receiving a FIN, tell the user-space to continue reading 1937 + * by returning a non-zero inq. 1938 + */ 1939 + if (inq == 0 && sock_flag(sk, SOCK_DONE)) 1940 + inq = 1; 1940 1941 return inq; 1941 1942 } 1942 1943
+7 -1
net/ipv4/tcp_input.c
··· 6498 6498 af_ops->send_synack(fastopen_sk, dst, &fl, req, 6499 6499 &foc, TCP_SYNACK_FASTOPEN); 6500 6500 /* Add the child socket directly into the accept queue */ 6501 - inet_csk_reqsk_queue_add(sk, req, fastopen_sk); 6501 + if (!inet_csk_reqsk_queue_add(sk, req, fastopen_sk)) { 6502 + reqsk_fastopen_remove(fastopen_sk, req, false); 6503 + bh_unlock_sock(fastopen_sk); 6504 + sock_put(fastopen_sk); 6505 + reqsk_put(req); 6506 + goto drop; 6507 + } 6502 6508 sk->sk_data_ready(sk); 6503 6509 bh_unlock_sock(fastopen_sk); 6504 6510 sock_put(fastopen_sk);
+2 -2
net/ipv6/fou6.c
··· 94 94 int ret; 95 95 96 96 len = sizeof(struct udphdr) + sizeof(struct guehdr); 97 - if (!pskb_may_pull(skb, len)) 97 + if (!pskb_may_pull(skb, transport_offset + len)) 98 98 return -EINVAL; 99 99 100 100 guehdr = (struct guehdr *)&udp_hdr(skb)[1]; ··· 129 129 130 130 optlen = guehdr->hlen << 2; 131 131 132 - if (!pskb_may_pull(skb, len + optlen)) 132 + if (!pskb_may_pull(skb, transport_offset + len + optlen)) 133 133 return -EINVAL; 134 134 135 135 guehdr = (struct guehdr *)&udp_hdr(skb)[1];
+18 -8
net/rxrpc/conn_client.c
··· 353 353 * normally have to take channel_lock but we do this before anyone else 354 354 * can see the connection. 355 355 */ 356 - list_add_tail(&call->chan_wait_link, &candidate->waiting_calls); 356 + list_add(&call->chan_wait_link, &candidate->waiting_calls); 357 357 358 358 if (cp->exclusive) { 359 359 call->conn = candidate; ··· 432 432 call->conn = conn; 433 433 call->security_ix = conn->security_ix; 434 434 call->service_id = conn->service_id; 435 - list_add(&call->chan_wait_link, &conn->waiting_calls); 435 + list_add_tail(&call->chan_wait_link, &conn->waiting_calls); 436 436 spin_unlock(&conn->channel_lock); 437 437 _leave(" = 0 [extant %d]", conn->debug_id); 438 438 return 0; ··· 704 704 705 705 ret = rxrpc_wait_for_channel(call, gfp); 706 706 if (ret < 0) { 707 + trace_rxrpc_client(call->conn, ret, rxrpc_client_chan_wait_failed); 707 708 rxrpc_disconnect_client_call(call); 708 709 goto out; 709 710 } ··· 775 774 */ 776 775 void rxrpc_disconnect_client_call(struct rxrpc_call *call) 777 776 { 778 - unsigned int channel = call->cid & RXRPC_CHANNELMASK; 779 777 struct rxrpc_connection *conn = call->conn; 780 - struct rxrpc_channel *chan = &conn->channels[channel]; 778 + struct rxrpc_channel *chan = NULL; 781 779 struct rxrpc_net *rxnet = conn->params.local->rxnet; 782 - 783 - trace_rxrpc_client(conn, channel, rxrpc_client_chan_disconnect); 784 - call->conn = NULL; 780 + unsigned int channel = -1; 781 + u32 cid; 785 782 786 783 spin_lock(&conn->channel_lock); 784 + 785 + cid = call->cid; 786 + if (cid) { 787 + channel = cid & RXRPC_CHANNELMASK; 788 + chan = &conn->channels[channel]; 789 + } 790 + trace_rxrpc_client(conn, channel, rxrpc_client_chan_disconnect); 791 + call->conn = NULL; 787 792 788 793 /* Calls that have never actually been assigned a channel can simply be 789 794 * discarded. If the conn didn't get used either, it will follow ··· 814 807 goto out; 815 808 } 816 809 817 - ASSERTCMP(rcu_access_pointer(chan->call), ==, call); 810 + if (rcu_access_pointer(chan->call) != call) { 811 + spin_unlock(&conn->channel_lock); 812 + BUG(); 813 + } 818 814 819 815 /* If a client call was exposed to the world, we save the result for 820 816 * retransmission.
+6 -16
net/sched/act_tunnel_key.c
··· 201 201 { 202 202 if (!p) 203 203 return; 204 - if (p->tcft_action == TCA_TUNNEL_KEY_ACT_SET) { 205 - #ifdef CONFIG_DST_CACHE 206 - struct ip_tunnel_info *info = &p->tcft_enc_metadata->u.tun_info; 207 - 208 - dst_cache_destroy(&info->dst_cache); 209 - #endif 204 + if (p->tcft_action == TCA_TUNNEL_KEY_ACT_SET) 210 205 dst_release(&p->tcft_enc_metadata->dst); 211 - } 206 + 212 207 kfree_rcu(p, rcu); 213 208 } 214 209 ··· 333 338 &metadata->u.tun_info, 334 339 opts_len, extack); 335 340 if (ret < 0) 336 - goto release_dst_cache; 341 + goto release_tun_meta; 337 342 } 338 343 339 344 metadata->u.tun_info.mode |= IP_TUNNEL_INFO_TX; ··· 349 354 &act_tunnel_key_ops, bind, true); 350 355 if (ret) { 351 356 NL_SET_ERR_MSG(extack, "Cannot create TC IDR"); 352 - goto release_dst_cache; 357 + goto release_tun_meta; 353 358 } 354 359 355 360 ret = ACT_P_CREATED; 356 361 } else if (!ovr) { 357 362 NL_SET_ERR_MSG(extack, "TC IDR already exists"); 358 363 ret = -EEXIST; 359 - goto release_dst_cache; 364 + goto release_tun_meta; 360 365 } 361 366 362 367 t = to_tunnel_key(*a); ··· 366 371 NL_SET_ERR_MSG(extack, "Cannot allocate tunnel key parameters"); 367 372 ret = -ENOMEM; 368 373 exists = true; 369 - goto release_dst_cache; 374 + goto release_tun_meta; 370 375 } 371 376 params_new->tcft_action = parm->t_action; 372 377 params_new->tcft_enc_metadata = metadata; ··· 383 388 384 389 return ret; 385 390 386 - release_dst_cache: 387 - #ifdef CONFIG_DST_CACHE 388 - if (metadata) 389 - dst_cache_destroy(&metadata->u.tun_info.dst_cache); 390 391 release_tun_meta: 391 - #endif 392 392 if (metadata) 393 393 dst_release(&metadata->dst); 394 394
+7 -10
net/sched/cls_api.c
··· 470 470 { 471 471 struct tcf_block *block = chain->block; 472 472 const struct tcf_proto_ops *tmplt_ops; 473 - bool is_last, free_block = false; 473 + bool free_block = false; 474 474 unsigned int refcnt; 475 475 void *tmplt_priv; 476 - u32 chain_index; 477 476 478 477 mutex_lock(&block->lock); 479 478 if (explicitly_created) { ··· 491 492 * save these to temporary variables. 492 493 */ 493 494 refcnt = --chain->refcnt; 494 - is_last = refcnt - chain->action_refcnt == 0; 495 495 tmplt_ops = chain->tmplt_ops; 496 496 tmplt_priv = chain->tmplt_priv; 497 - chain_index = chain->index; 498 - 499 - if (refcnt == 0) 500 - free_block = tcf_chain_detach(chain); 501 - mutex_unlock(&block->lock); 502 497 503 498 /* The last dropped non-action reference will trigger notification. */ 504 - if (is_last && !by_act) { 505 - tc_chain_notify_delete(tmplt_ops, tmplt_priv, chain_index, 499 + if (refcnt - chain->action_refcnt == 0 && !by_act) { 500 + tc_chain_notify_delete(tmplt_ops, tmplt_priv, chain->index, 506 501 block, NULL, 0, 0, false); 507 502 /* Last reference to chain, no need to lock. */ 508 503 chain->flushing = false; 509 504 } 505 + 506 + if (refcnt == 0) 507 + free_block = tcf_chain_detach(chain); 508 + mutex_unlock(&block->lock); 510 509 511 510 if (refcnt == 0) { 512 511 tc_chain_tmplt_del(tmplt_ops, tmplt_priv);
+25 -24
net/sched/cls_flower.c
··· 1348 1348 if (err < 0) 1349 1349 goto errout; 1350 1350 1351 + if (tb[TCA_FLOWER_FLAGS]) { 1352 + fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]); 1353 + 1354 + if (!tc_flags_valid(fnew->flags)) { 1355 + err = -EINVAL; 1356 + goto errout; 1357 + } 1358 + } 1359 + 1360 + err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], ovr, 1361 + tp->chain->tmplt_priv, extack); 1362 + if (err) 1363 + goto errout; 1364 + 1365 + err = fl_check_assign_mask(head, fnew, fold, mask); 1366 + if (err) 1367 + goto errout; 1368 + 1351 1369 if (!handle) { 1352 1370 handle = 1; 1353 1371 err = idr_alloc_u32(&head->handle_idr, fnew, &handle, ··· 1376 1358 handle, GFP_KERNEL); 1377 1359 } 1378 1360 if (err) 1379 - goto errout; 1361 + goto errout_mask; 1380 1362 fnew->handle = handle; 1381 - 1382 - if (tb[TCA_FLOWER_FLAGS]) { 1383 - fnew->flags = nla_get_u32(tb[TCA_FLOWER_FLAGS]); 1384 - 1385 - if (!tc_flags_valid(fnew->flags)) { 1386 - err = -EINVAL; 1387 - goto errout_idr; 1388 - } 1389 - } 1390 - 1391 - err = fl_set_parms(net, tp, fnew, mask, base, tb, tca[TCA_RATE], ovr, 1392 - tp->chain->tmplt_priv, extack); 1393 - if (err) 1394 - goto errout_idr; 1395 - 1396 - err = fl_check_assign_mask(head, fnew, fold, mask); 1397 - if (err) 1398 - goto errout_idr; 1399 1363 1400 1364 if (!fold && __fl_lookup(fnew->mask, &fnew->mkey)) { 1401 1365 err = -EEXIST; 1402 - goto errout_mask; 1366 + goto errout_idr; 1403 1367 } 1404 1368 1405 1369 err = rhashtable_insert_fast(&fnew->mask->ht, &fnew->ht_node, 1406 1370 fnew->mask->filter_ht_params); 1407 1371 if (err) 1408 - goto errout_mask; 1372 + goto errout_idr; 1409 1373 1410 1374 if (!tc_skip_hw(fnew->flags)) { 1411 1375 err = fl_hw_replace_filter(tp, fnew, extack); ··· 1426 1426 rhashtable_remove_fast(&fnew->mask->ht, &fnew->ht_node, 1427 1427 fnew->mask->filter_ht_params); 1428 1428 1429 - errout_mask: 1430 - fl_mask_put(head, fnew->mask, false); 1431 - 1432 1429 errout_idr: 1433 1430 if (!fold) 1434 1431 idr_remove(&head->handle_idr, fnew->handle); 1432 + 1433 + errout_mask: 1434 + fl_mask_put(head, fnew->mask, false); 1435 + 1435 1436 errout: 1436 1437 tcf_exts_destroy(&fnew->exts); 1437 1438 kfree(fnew);
-6
net/sctp/auth.c
··· 471 471 struct crypto_shash *tfm = NULL; 472 472 __u16 id; 473 473 474 - /* If AUTH extension is disabled, we are done */ 475 - if (!ep->auth_enable) { 476 - ep->auth_hmacs = NULL; 477 - return 0; 478 - } 479 - 480 474 /* If the transforms are already allocated, we are done */ 481 475 if (ep->auth_hmacs) 482 476 return 0;
+10 -8
net/sctp/endpointola.c
··· 107 107 auth_chunks->param_hdr.length = 108 108 htons(sizeof(struct sctp_paramhdr) + 2); 109 109 } 110 + 111 + /* Allocate and initialize transorms arrays for supported 112 + * HMACs. 113 + */ 114 + err = sctp_auth_init_hmacs(ep, gfp); 115 + if (err) 116 + goto nomem; 110 117 } 111 118 112 119 /* Initialize the base structure. */ ··· 157 150 INIT_LIST_HEAD(&ep->endpoint_shared_keys); 158 151 null_key = sctp_auth_shkey_create(0, gfp); 159 152 if (!null_key) 160 - goto nomem; 153 + goto nomem_shkey; 161 154 162 155 list_add(&null_key->key_list, &ep->endpoint_shared_keys); 163 - 164 - /* Allocate and initialize transorms arrays for supported HMACs. */ 165 - err = sctp_auth_init_hmacs(ep, gfp); 166 - if (err) 167 - goto nomem_hmacs; 168 156 169 157 /* Add the null key to the endpoint shared keys list and 170 158 * set the hmcas and chunks pointers. ··· 171 169 172 170 return ep; 173 171 174 - nomem_hmacs: 175 - sctp_auth_destroy_keys(&ep->endpoint_shared_keys); 172 + nomem_shkey: 173 + sctp_auth_destroy_hmacs(ep->auth_hmacs); 176 174 nomem: 177 175 /* Free all allocations */ 178 176 kfree(auth_hmacs);
+34 -10
net/sctp/socket.c
··· 102 102 struct sctp_chunk *chunk); 103 103 static int sctp_do_bind(struct sock *, union sctp_addr *, int); 104 104 static int sctp_autobind(struct sock *sk); 105 - static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, 106 - struct sctp_association *assoc, 107 - enum sctp_socket_type type); 105 + static int sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, 106 + struct sctp_association *assoc, 107 + enum sctp_socket_type type); 108 108 109 109 static unsigned long sctp_memory_pressure; 110 110 static atomic_long_t sctp_memory_allocated; ··· 4891 4891 /* Populate the fields of the newsk from the oldsk and migrate the 4892 4892 * asoc to the newsk. 4893 4893 */ 4894 - sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); 4894 + error = sctp_sock_migrate(sk, newsk, asoc, SCTP_SOCKET_TCP); 4895 + if (error) { 4896 + sk_common_release(newsk); 4897 + newsk = NULL; 4898 + } 4895 4899 4896 4900 out: 4897 4901 release_sock(sk); ··· 5643 5639 /* Populate the fields of the newsk from the oldsk and migrate the 5644 5640 * asoc to the newsk. 5645 5641 */ 5646 - sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH); 5642 + err = sctp_sock_migrate(sk, sock->sk, asoc, 5643 + SCTP_SOCKET_UDP_HIGH_BANDWIDTH); 5644 + if (err) { 5645 + sock_release(sock); 5646 + sock = NULL; 5647 + } 5647 5648 5648 5649 *sockp = sock; 5649 5650 ··· 9180 9171 /* Populate the fields of the newsk from the oldsk and migrate the assoc 9181 9172 * and its messages to the newsk. 9182 9173 */ 9183 - static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, 9184 - struct sctp_association *assoc, 9185 - enum sctp_socket_type type) 9174 + static int sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, 9175 + struct sctp_association *assoc, 9176 + enum sctp_socket_type type) 9186 9177 { 9187 9178 struct sctp_sock *oldsp = sctp_sk(oldsk); 9188 9179 struct sctp_sock *newsp = sctp_sk(newsk); ··· 9191 9182 struct sk_buff *skb, *tmp; 9192 9183 struct sctp_ulpevent *event; 9193 9184 struct sctp_bind_hashbucket *head; 9185 + int err; 9194 9186 9195 9187 /* Migrate socket buffer sizes and all the socket level options to the 9196 9188 * new socket. ··· 9220 9210 /* Copy the bind_addr list from the original endpoint to the new 9221 9211 * endpoint so that we can handle restarts properly 9222 9212 */ 9223 - sctp_bind_addr_dup(&newsp->ep->base.bind_addr, 9224 - &oldsp->ep->base.bind_addr, GFP_KERNEL); 9213 + err = sctp_bind_addr_dup(&newsp->ep->base.bind_addr, 9214 + &oldsp->ep->base.bind_addr, GFP_KERNEL); 9215 + if (err) 9216 + return err; 9217 + 9218 + /* New ep's auth_hmacs should be set if old ep's is set, in case 9219 + * that net->sctp.auth_enable has been changed to 0 by users and 9220 + * new ep's auth_hmacs couldn't be set in sctp_endpoint_init(). 9221 + */ 9222 + if (oldsp->ep->auth_hmacs) { 9223 + err = sctp_auth_init_hmacs(newsp->ep, GFP_KERNEL); 9224 + if (err) 9225 + return err; 9226 + } 9225 9227 9226 9228 /* Move any messages in the old socket's receive queue that are for the 9227 9229 * peeled off association to the new socket's receive queue. ··· 9318 9296 } 9319 9297 9320 9298 release_sock(newsk); 9299 + 9300 + return 0; 9321 9301 } 9322 9302 9323 9303
-2
net/sctp/stream.c
··· 230 230 for (i = 0; i < stream->outcnt; i++) 231 231 SCTP_SO(stream, i)->state = SCTP_STREAM_OPEN; 232 232 233 - sched->init(stream); 234 - 235 233 in: 236 234 sctp_stream_interleave_init(stream); 237 235 if (!incnt)
+1 -1
net/tipc/socket.c
··· 1333 1333 1334 1334 if (unlikely(!dest)) { 1335 1335 dest = &tsk->peer; 1336 - if (!syn || dest->family != AF_TIPC) 1336 + if (!syn && dest->family != AF_TIPC) 1337 1337 return -EDESTADDRREQ; 1338 1338 } 1339 1339
+15 -7
net/vmw_vsock/virtio_transport_common.c
··· 662 662 */ 663 663 static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt) 664 664 { 665 + const struct virtio_transport *t; 666 + struct virtio_vsock_pkt *reply; 665 667 struct virtio_vsock_pkt_info info = { 666 668 .op = VIRTIO_VSOCK_OP_RST, 667 669 .type = le16_to_cpu(pkt->hdr.type), ··· 674 672 if (le16_to_cpu(pkt->hdr.op) == VIRTIO_VSOCK_OP_RST) 675 673 return 0; 676 674 677 - pkt = virtio_transport_alloc_pkt(&info, 0, 678 - le64_to_cpu(pkt->hdr.dst_cid), 679 - le32_to_cpu(pkt->hdr.dst_port), 680 - le64_to_cpu(pkt->hdr.src_cid), 681 - le32_to_cpu(pkt->hdr.src_port)); 682 - if (!pkt) 675 + reply = virtio_transport_alloc_pkt(&info, 0, 676 + le64_to_cpu(pkt->hdr.dst_cid), 677 + le32_to_cpu(pkt->hdr.dst_port), 678 + le64_to_cpu(pkt->hdr.src_cid), 679 + le32_to_cpu(pkt->hdr.src_port)); 680 + if (!reply) 683 681 return -ENOMEM; 684 682 685 - return virtio_transport_get_ops()->send_pkt(pkt); 683 + t = virtio_transport_get_ops(); 684 + if (!t) { 685 + virtio_transport_free_pkt(reply); 686 + return -ENOTCONN; 687 + } 688 + 689 + return t->send_pkt(reply); 686 690 } 687 691 688 692 static void virtio_transport_wait_close(struct sock *sk, long timeout)
+5 -1
net/x25/af_x25.c
··· 820 820 sock->state = SS_CONNECTED; 821 821 rc = 0; 822 822 out_put_neigh: 823 - if (rc) 823 + if (rc) { 824 + read_lock_bh(&x25_list_lock); 824 825 x25_neigh_put(x25->neighbour); 826 + x25->neighbour = NULL; 827 + read_unlock_bh(&x25_list_lock); 828 + } 825 829 out_put_route: 826 830 x25_route_put(rt); 827 831 out:
+4 -1
net/xdp/xsk.c
··· 407 407 if (sxdp->sxdp_family != AF_XDP) 408 408 return -EINVAL; 409 409 410 + flags = sxdp->sxdp_flags; 411 + if (flags & ~(XDP_SHARED_UMEM | XDP_COPY | XDP_ZEROCOPY)) 412 + return -EINVAL; 413 + 410 414 mutex_lock(&xs->mutex); 411 415 if (xs->dev) { 412 416 err = -EBUSY; ··· 429 425 } 430 426 431 427 qid = sxdp->sxdp_queue_id; 432 - flags = sxdp->sxdp_flags; 433 428 434 429 if (flags & XDP_SHARED_UMEM) { 435 430 struct xdp_sock *umem_xs;
+2 -2
net/xdp/xsk_diag.c
··· 68 68 err = nla_put(nlskb, XDP_DIAG_UMEM, sizeof(du), &du); 69 69 70 70 if (!err && umem->fq) 71 - err = xsk_diag_put_ring(xs->tx, XDP_DIAG_UMEM_FILL_RING, nlskb); 71 + err = xsk_diag_put_ring(umem->fq, XDP_DIAG_UMEM_FILL_RING, nlskb); 72 72 if (!err && umem->cq) { 73 - err = xsk_diag_put_ring(xs->tx, XDP_DIAG_UMEM_COMPLETION_RING, 73 + err = xsk_diag_put_ring(umem->cq, XDP_DIAG_UMEM_COMPLETION_RING, 74 74 nlskb); 75 75 } 76 76 return err;
+2 -2
net/xdp/xsk_queue.h
··· 174 174 if (!xskq_is_valid_addr(q, d->addr)) 175 175 return false; 176 176 177 - if (((d->addr + d->len) & q->chunk_mask) != 178 - (d->addr & q->chunk_mask)) { 177 + if (((d->addr + d->len) & q->chunk_mask) != (d->addr & q->chunk_mask) || 178 + d->options) { 179 179 q->invalid_descs++; 180 180 return false; 181 181 }
+2 -2
samples/bpf/hbm.c
··· 18 18 * Default is /hbm1 19 19 * -r <rate> Rate limit in Mbps 20 20 * -s Get HBM stats (marked, dropped, etc.) 21 - * -t <time> Exit after specified seconds (deault is 0) 21 + * -t <time> Exit after specified seconds (default is 0) 22 22 * -w Work conserving flag. cgroup can increase its bandwidth 23 23 * beyond the rate limit specified while there is available 24 24 * bandwidth. Current implementation assumes there is only ··· 376 376 " Default is /hbm1\n" 377 377 " -r <rate> Rate in Mbps\n" 378 378 " -s Update HBM stats\n" 379 - " -t <time> Exit after specified seconds (deault is 0)\n" 379 + " -t <time> Exit after specified seconds (default is 0)\n" 380 380 " -w Work conserving flag. cgroup can increase\n" 381 381 " bandwidth beyond the rate limit specified\n" 382 382 " while there is available bandwidth. Current\n"
+2 -1
tools/lib/bpf/Makefile
··· 147 147 148 148 TARGETS = $(CMD_TARGETS) 149 149 150 - all: fixdep all_cmd 150 + all: fixdep 151 + $(Q)$(MAKE) all_cmd 151 152 152 153 all_cmd: $(CMD_TARGETS) check 153 154
+2
tools/lib/bpf/libbpf.c
··· 838 838 if (IS_ERR(obj->btf) || btf__load(obj->btf)) { 839 839 pr_warning("Error loading ELF section %s: %ld. Ignored and continue.\n", 840 840 BTF_ELF_SEC, PTR_ERR(obj->btf)); 841 + if (!IS_ERR(obj->btf)) 842 + btf__free(obj->btf); 841 843 obj->btf = NULL; 842 844 } 843 845 } else if (strcmp(name, BTF_EXT_ELF_SEC) == 0) {
+23 -10
tools/testing/selftests/bpf/Makefile
··· 153 153 endif 154 154 endif 155 155 156 + TEST_PROGS_CFLAGS := -I. -I$(OUTPUT) 157 + TEST_VERIFIER_CFLAGS := -I. -I$(OUTPUT) -Iverifier 158 + 156 159 ifneq ($(SUBREG_CODEGEN),) 157 160 ALU32_BUILD_DIR = $(OUTPUT)/alu32 158 161 TEST_CUSTOM_PROGS += $(ALU32_BUILD_DIR)/test_progs_32 ··· 165 162 $(ALU32_BUILD_DIR)/urandom_read: $(OUTPUT)/urandom_read 166 163 cp $< $@ 167 164 168 - $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(ALU32_BUILD_DIR) \ 165 + $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(OUTPUT)/libbpf.a\ 166 + $(ALU32_BUILD_DIR) \ 169 167 $(ALU32_BUILD_DIR)/urandom_read 170 - $(CC) $(CFLAGS) -o $(ALU32_BUILD_DIR)/test_progs_32 $< \ 171 - trace_helpers.c prog_tests/*.c $(OUTPUT)/libbpf.a $(LDLIBS) 168 + $(CC) $(TEST_PROGS_CFLAGS) $(CFLAGS) \ 169 + -o $(ALU32_BUILD_DIR)/test_progs_32 \ 170 + test_progs.c trace_helpers.c prog_tests/*.c \ 171 + $(OUTPUT)/libbpf.a $(LDLIBS) 172 172 173 173 $(ALU32_BUILD_DIR)/test_progs_32: $(PROG_TESTS_H) 174 - $(ALU32_BUILD_DIR)/test_progs_32: CFLAGS += -I$(OUTPUT) 175 174 $(ALU32_BUILD_DIR)/test_progs_32: prog_tests/*.c 176 175 177 176 $(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \ ··· 207 202 208 203 PROG_TESTS_H := $(OUTPUT)/prog_tests/tests.h 209 204 $(OUTPUT)/test_progs: $(PROG_TESTS_H) 210 - $(OUTPUT)/test_progs: CFLAGS += -I$(OUTPUT) 205 + $(OUTPUT)/test_progs: CFLAGS += $(TEST_PROGS_CFLAGS) 211 206 $(OUTPUT)/test_progs: prog_tests/*.c 212 207 208 + PROG_TESTS_DIR = $(OUTPUT)/prog_tests 209 + $(PROG_TESTS_DIR): 210 + mkdir -p $@ 211 + 213 212 PROG_TESTS_FILES := $(wildcard prog_tests/*.c) 214 - $(PROG_TESTS_H): $(PROG_TESTS_FILES) 215 - $(shell ( cd prog_tests/ 213 + $(PROG_TESTS_H): $(PROG_TESTS_DIR) $(PROG_TESTS_FILES) 214 + $(shell ( cd prog_tests/; \ 216 215 echo '/* Generated header, do not edit */'; \ 217 216 echo '#ifdef DECLARE'; \ 218 217 ls *.c 2> /dev/null | \ ··· 230 221 231 222 VERIFIER_TESTS_H := $(OUTPUT)/verifier/tests.h 232 223 $(OUTPUT)/test_verifier: $(VERIFIER_TESTS_H) 233 - $(OUTPUT)/test_verifier: CFLAGS += -I$(OUTPUT) 224 + $(OUTPUT)/test_verifier: CFLAGS += $(TEST_VERIFIER_CFLAGS) 225 + 226 + VERIFIER_TESTS_DIR = $(OUTPUT)/verifier 227 + $(VERIFIER_TESTS_DIR): 228 + mkdir -p $@ 234 229 235 230 VERIFIER_TEST_FILES := $(wildcard verifier/*.c) 236 - $(OUTPUT)/verifier/tests.h: $(VERIFIER_TEST_FILES) 237 - $(shell ( cd verifier/ 231 + $(OUTPUT)/verifier/tests.h: $(VERIFIER_TESTS_DIR) $(VERIFIER_TEST_FILES) 232 + $(shell ( cd verifier/; \ 238 233 echo '/* Generated header, do not edit */'; \ 239 234 echo '#ifdef FILL_ARRAY'; \ 240 235 ls *.c 2> /dev/null | \
+1 -1
tools/testing/selftests/bpf/prog_tests/signal_pending.c
··· 12 12 struct itimerval timeo = { 13 13 .it_value.tv_usec = 100000, /* 100ms */ 14 14 }; 15 - __u32 duration, retval; 15 + __u32 duration = 0, retval; 16 16 int prog_fd; 17 17 int err; 18 18 int i;
+52 -2
tools/testing/selftests/bpf/test_lwt_ip_encap.sh
··· 78 78 TESTS_SUCCEEDED=0 79 79 TESTS_FAILED=0 80 80 81 + TMPFILE="" 82 + 81 83 process_test_results() 82 84 { 83 85 if [[ "${TEST_STATUS}" -eq 0 ]] ; then ··· 149 147 ip -netns ${NS2} -6 addr add ${IPv6_7}/128 nodad dev veth7 150 148 ip -netns ${NS3} -6 addr add ${IPv6_8}/128 nodad dev veth8 151 149 152 - 153 150 ip -netns ${NS1} link set dev veth1 up 154 151 ip -netns ${NS2} link set dev veth2 up 155 152 ip -netns ${NS2} link set dev veth3 up ··· 206 205 # configure IPv4 GRE device in NS3, and a route to it via the "bottom" route 207 206 ip -netns ${NS3} tunnel add gre_dev mode gre remote ${IPv4_1} local ${IPv4_GRE} ttl 255 208 207 ip -netns ${NS3} link set gre_dev up 209 - ip -netns ${NS3} addr add ${IPv4_GRE} nodad dev gre_dev 208 + ip -netns ${NS3} addr add ${IPv4_GRE} dev gre_dev 210 209 ip -netns ${NS1} route add ${IPv4_GRE}/32 dev veth5 via ${IPv4_6} 211 210 ip -netns ${NS2} route add ${IPv4_GRE}/32 dev veth7 via ${IPv4_8} 212 211 ··· 223 222 ip netns exec ${NS2} sysctl -wq net.ipv4.conf.all.rp_filter=0 224 223 ip netns exec ${NS3} sysctl -wq net.ipv4.conf.all.rp_filter=0 225 224 225 + TMPFILE=$(mktemp /tmp/test_lwt_ip_encap.XXXXXX) 226 + 226 227 sleep 1 # reduce flakiness 227 228 set +e 228 229 } 229 230 230 231 cleanup() 231 232 { 233 + if [ -f ${TMPFILE} ] ; then 234 + rm ${TMPFILE} 235 + fi 236 + 232 237 ip netns del ${NS1} 2> /dev/null 233 238 ip netns del ${NS2} 2> /dev/null 234 239 ip netns del ${NS3} 2> /dev/null ··· 285 278 fi 286 279 } 287 280 281 + test_gso() 282 + { 283 + local readonly PROTO=$1 284 + local readonly PKT_SZ=5000 285 + local IP_DST="" 286 + : > ${TMPFILE} # trim the capture file 287 + 288 + # check that nc is present 289 + command -v nc >/dev/null 2>&1 || \ 290 + { echo >&2 "nc is not available: skipping TSO tests"; return; } 291 + 292 + # listen on IPv*_DST, capture TCP into $TMPFILE 293 + if [ "${PROTO}" == "IPv4" ] ; then 294 + IP_DST=${IPv4_DST} 295 + ip netns exec ${NS3} bash -c \ 296 + "nc -4 -l -s ${IPv4_DST} -p 9000 > ${TMPFILE} &" 297 + elif [ "${PROTO}" == "IPv6" ] ; then 298 + IP_DST=${IPv6_DST} 299 + ip netns exec ${NS3} bash -c \ 300 + "nc -6 -l -s ${IPv6_DST} -p 9000 > ${TMPFILE} &" 301 + RET=$? 302 + else 303 + echo " test_gso: unknown PROTO: ${PROTO}" 304 + TEST_STATUS=1 305 + fi 306 + sleep 1 # let nc start listening 307 + 308 + # send a packet larger than MTU 309 + ip netns exec ${NS1} bash -c \ 310 + "dd if=/dev/zero bs=$PKT_SZ count=1 > /dev/tcp/${IP_DST}/9000 2>/dev/null" 311 + sleep 2 # let the packet get delivered 312 + 313 + # verify we received all expected bytes 314 + SZ=$(stat -c %s ${TMPFILE}) 315 + if [ "$SZ" != "$PKT_SZ" ] ; then 316 + echo " test_gso failed: ${PROTO}" 317 + TEST_STATUS=1 318 + fi 319 + } 320 + 288 321 test_egress() 289 322 { 290 323 local readonly ENCAP=$1 ··· 354 307 fi 355 308 test_ping IPv4 0 356 309 test_ping IPv6 0 310 + test_gso IPv4 311 + test_gso IPv6 357 312 358 313 # a negative test: remove routes to GRE devices: ping fails 359 314 remove_routes_to_gredev ··· 399 350 ip -netns ${NS2} -6 route add ${IPv6_DST} encap bpf in obj test_lwt_ip_encap.o sec encap_gre6 dev veth2 400 351 else 401 352 echo "FAIL: unknown encap ${ENCAP}" 353 + TEST_STATUS=1 402 354 fi 403 355 test_ping IPv4 0 404 356 test_ping IPv6 0
+14 -1
tools/testing/selftests/bpf/verifier/ld_imm64.c
··· 122 122 .insns = { 123 123 BPF_MOV64_IMM(BPF_REG_1, 0), 124 124 BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, 0, BPF_REG_1, 0, 1), 125 - BPF_RAW_INSN(0, 0, 0, 0, 1), 125 + BPF_RAW_INSN(0, 0, 0, 0, 0), 126 126 BPF_EXIT_INSN(), 127 127 }, 128 128 .errstr = "not pointing to valid bpf_map", ··· 137 137 BPF_EXIT_INSN(), 138 138 }, 139 139 .errstr = "invalid bpf_ld_imm64 insn", 140 + .result = REJECT, 141 + }, 142 + { 143 + "test14 ld_imm64: reject 2nd imm != 0", 144 + .insns = { 145 + BPF_MOV64_IMM(BPF_REG_0, 0), 146 + BPF_RAW_INSN(BPF_LD | BPF_IMM | BPF_DW, BPF_REG_1, 147 + BPF_PSEUDO_MAP_FD, 0, 0), 148 + BPF_RAW_INSN(0, 0, 0, 0, 0xfefefe), 149 + BPF_EXIT_INSN(), 150 + }, 151 + .fixup_map_hash_48b = { 1 }, 152 + .errstr = "unrecognized bpf_ld_imm64 insn", 140 153 .result = REJECT, 141 154 },