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

Configure Feed

Select the types of activity you want to include in your feed.

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

Pull networking fixes from David Miller:
"Nothing earth shattering here, lots of small fixes (f.e. missing RCU
protection, bad ref counting, missing memset(), etc.) all over the
place:

1) Use get_file_rcu() in task_file iterator, from Yonghong Song.

2) There are two ways to set remote source MAC addresses in macvlan
driver, but only one of which validates things properly. Fix this.
From Alvin Šipraga.

3) Missing of_node_put() in gianfar probing, from Sumera
Priyadarsini.

4) Preserve device wanted feature bits across multiple netlink
ethtool requests, from Maxim Mikityanskiy.

5) Fix rcu_sched stall in task and task_file bpf iterators, from
Yonghong Song.

6) Avoid reset after device destroy in ena driver, from Shay
Agroskin.

7) Missing memset() in netlink policy export reallocation path, from
Johannes Berg.

8) Fix info leak in __smc_diag_dump(), from Peilin Ye.

9) Decapsulate ECN properly for ipv6 in ipv4 tunnels, from Mark
Tomlinson.

10) Fix number of data stream negotiation in SCTP, from David Laight.

11) Fix double free in connection tracker action module, from Alaa
Hleihel.

12) Don't allow empty NHA_GROUP attributes, from Nikolay Aleksandrov"

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (46 commits)
net: nexthop: don't allow empty NHA_GROUP
bpf: Fix two typos in uapi/linux/bpf.h
net: dsa: b53: check for timeout
tipc: call rcu_read_lock() in tipc_aead_encrypt_done()
net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow
net: sctp: Fix negotiation of the number of data streams.
dt-bindings: net: renesas, ether: Improve schema validation
gre6: Fix reception with IP6_TNL_F_RCV_DSCP_COPY
hv_netvsc: Fix the queue_mapping in netvsc_vf_xmit()
hv_netvsc: Remove "unlikely" from netvsc_select_queue
bpf: selftests: global_funcs: Check err_str before strstr
bpf: xdp: Fix XDP mode when no mode flags specified
selftests/bpf: Remove test_align leftovers
tools/resolve_btfids: Fix sections with wrong alignment
net/smc: Prevent kernel-infoleak in __smc_diag_dump()
sfc: fix build warnings on 32-bit
net: phy: mscc: Fix a couple of spelling mistakes "spcified" -> "specified"
libbpf: Fix map index used in error message
net: gemini: Fix missing free_netdev() in error path of gemini_ethernet_port_probe()
net: atlantic: Use readx_poll_timeout() for large timeout
...

+310 -163
+15 -7
Documentation/devicetree/bindings/net/renesas,ether.yaml
··· 59 59 clocks: 60 60 maxItems: 1 61 61 62 - pinctrl-0: true 62 + power-domains: 63 + maxItems: 1 63 64 64 - pinctrl-names: true 65 + resets: 66 + maxItems: 1 67 + 68 + phy-mode: true 69 + 70 + phy-handle: true 65 71 66 72 renesas,no-ether-link: 67 73 type: boolean ··· 80 74 specify when the Ether LINK signal is active-low instead of normal 81 75 active-high 82 76 77 + patternProperties: 78 + "^ethernet-phy@[0-9a-f]$": 79 + type: object 80 + $ref: ethernet-phy.yaml# 81 + 83 82 required: 84 83 - compatible 85 84 - reg ··· 94 83 - '#address-cells' 95 84 - '#size-cells' 96 85 - clocks 97 - - pinctrl-0 86 + 87 + additionalProperties: false 98 88 99 89 examples: 100 90 # Lager board ··· 111 99 clocks = <&mstp8_clks R8A7790_CLK_ETHER>; 112 100 phy-mode = "rmii"; 113 101 phy-handle = <&phy1>; 114 - pinctrl-0 = <&ether_pins>; 115 - pinctrl-names = "default"; 116 102 renesas,ether-link-active-low; 117 103 #address-cells = <1>; 118 104 #size-cells = <0>; ··· 119 109 reg = <1>; 120 110 interrupt-parent = <&irqc0>; 121 111 interrupts = <0 IRQ_TYPE_LEVEL_LOW>; 122 - pinctrl-0 = <&phy1_pins>; 123 - pinctrl-names = "default"; 124 112 }; 125 113 };
+16 -2
drivers/net/bonding/bond_main.c
··· 2948 2948 if (bond_time_in_interval(bond, last_rx, 1)) { 2949 2949 bond_propose_link_state(slave, BOND_LINK_UP); 2950 2950 commit++; 2951 + } else if (slave->link == BOND_LINK_BACK) { 2952 + bond_propose_link_state(slave, BOND_LINK_FAIL); 2953 + commit++; 2951 2954 } 2952 2955 continue; 2953 2956 } ··· 3059 3056 3060 3057 continue; 3061 3058 3059 + case BOND_LINK_FAIL: 3060 + bond_set_slave_link_state(slave, BOND_LINK_FAIL, 3061 + BOND_SLAVE_NOTIFY_NOW); 3062 + bond_set_slave_inactive_flags(slave, 3063 + BOND_SLAVE_NOTIFY_NOW); 3064 + 3065 + /* A slave has just been enslaved and has become 3066 + * the current active slave. 3067 + */ 3068 + if (rtnl_dereference(bond->curr_active_slave)) 3069 + RCU_INIT_POINTER(bond->current_arp_slave, NULL); 3070 + continue; 3071 + 3062 3072 default: 3063 3073 slave_err(bond->dev, slave->dev, 3064 3074 "impossible: link_new_state %d on slave\n", ··· 3121 3105 if (!curr_arp_slave) 3122 3106 return should_notify_rtnl; 3123 3107 } 3124 - 3125 - bond_set_slave_inactive_flags(curr_arp_slave, BOND_SLAVE_NOTIFY_LATER); 3126 3108 3127 3109 bond_for_each_slave_rcu(bond, slave, iter) { 3128 3110 if (!found && !before && bond_slave_is_up(slave))
+2
drivers/net/dsa/b53/b53_common.c
··· 1554 1554 return ret; 1555 1555 1556 1556 switch (ret) { 1557 + case -ETIMEDOUT: 1558 + return ret; 1557 1559 case -ENOSPC: 1558 1560 dev_dbg(dev->dev, "{%pM,%.4d} no space left in ARL\n", 1559 1561 addr, vid);
+1 -1
drivers/net/dsa/ocelot/Kconfig
··· 9 9 select NET_DSA_TAG_OCELOT 10 10 select FSL_ENETC_MDIO 11 11 help 12 - This driver supports network switches from the the Vitesse / 12 + This driver supports network switches from the Vitesse / 13 13 Microsemi / Microchip Ocelot family of switching cores that are 14 14 connected to their host CPU via Ethernet. 15 15 The following switches are supported:
+18 -17
drivers/net/ethernet/amazon/ena/ena_netdev.c
··· 2180 2180 int i; 2181 2181 2182 2182 for (i = first_index; i < first_index + count; i++) { 2183 - /* Check if napi was initialized before */ 2184 - if (!ENA_IS_XDP_INDEX(adapter, i) || 2185 - adapter->ena_napi[i].xdp_ring) 2186 - netif_napi_del(&adapter->ena_napi[i].napi); 2187 - else 2188 - WARN_ON(ENA_IS_XDP_INDEX(adapter, i) && 2189 - adapter->ena_napi[i].xdp_ring); 2183 + netif_napi_del(&adapter->ena_napi[i].napi); 2184 + 2185 + WARN_ON(!ENA_IS_XDP_INDEX(adapter, i) && 2186 + adapter->ena_napi[i].xdp_ring); 2190 2187 } 2191 2188 } 2192 2189 ··· 3598 3601 { 3599 3602 struct ena_adapter *adapter = 3600 3603 container_of(work, struct ena_adapter, reset_task); 3601 - struct pci_dev *pdev = adapter->pdev; 3602 3604 3603 - if (unlikely(!test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) { 3604 - dev_err(&pdev->dev, 3605 - "device reset schedule while reset bit is off\n"); 3606 - return; 3607 - } 3608 3605 rtnl_lock(); 3609 - ena_destroy_device(adapter, false); 3610 - ena_restore_device(adapter); 3606 + 3607 + if (likely(test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags))) { 3608 + ena_destroy_device(adapter, false); 3609 + ena_restore_device(adapter); 3610 + } 3611 + 3611 3612 rtnl_unlock(); 3612 3613 } 3613 3614 ··· 3687 3692 } 3688 3693 3689 3694 u64_stats_update_begin(&tx_ring->syncp); 3690 - tx_ring->tx_stats.missed_tx = missed_tx; 3695 + tx_ring->tx_stats.missed_tx += missed_tx; 3691 3696 u64_stats_update_end(&tx_ring->syncp); 3692 3697 3693 3698 return rc; ··· 4384 4389 netdev->rx_cpu_rmap = NULL; 4385 4390 } 4386 4391 #endif /* CONFIG_RFS_ACCEL */ 4387 - del_timer_sync(&adapter->timer_service); 4388 4392 4393 + /* Make sure timer and reset routine won't be called after 4394 + * freeing device resources. 4395 + */ 4396 + del_timer_sync(&adapter->timer_service); 4389 4397 cancel_work_sync(&adapter->reset_task); 4390 4398 4391 4399 rtnl_lock(); /* lock released inside the below if-else block */ ··· 4556 4558 tx_drops = ((u64)desc->tx_drops_high << 32) | desc->tx_drops_low; 4557 4559 4558 4560 u64_stats_update_begin(&adapter->syncp); 4561 + /* These stats are accumulated by the device, so the counters indicate 4562 + * all drops since last reset. 4563 + */ 4559 4564 adapter->dev_stats.rx_drops = rx_drops; 4560 4565 adapter->dev_stats.tx_drops = tx_drops; 4561 4566 u64_stats_update_end(&adapter->syncp);
+2 -2
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
··· 1631 1631 hw_atl_ts_reset_set(self, 0); 1632 1632 } 1633 1633 1634 - err = readx_poll_timeout_atomic(hw_atl_b0_ts_ready_and_latch_high_get, 1635 - self, val, val == 1, 10000U, 500000U); 1634 + err = readx_poll_timeout(hw_atl_b0_ts_ready_and_latch_high_get, self, 1635 + val, val == 1, 10000U, 500000U); 1636 1636 if (err) 1637 1637 return err; 1638 1638
+7 -3
drivers/net/ethernet/chelsio/cxgb4/sge.c
··· 2553 2553 2554 2554 pkt_len = ETH_HLEN + sizeof(CXGB4_SELFTEST_LB_STR); 2555 2555 2556 - flits = DIV_ROUND_UP(pkt_len + sizeof(struct cpl_tx_pkt) + 2557 - sizeof(*wr), sizeof(__be64)); 2556 + flits = DIV_ROUND_UP(pkt_len + sizeof(*cpl) + sizeof(*wr), 2557 + sizeof(__be64)); 2558 2558 ndesc = flits_to_desc(flits); 2559 2559 2560 2560 lb = &pi->ethtool_lb; 2561 2561 lb->loopback = 1; 2562 2562 2563 2563 q = &adap->sge.ethtxq[pi->first_qset]; 2564 + __netif_tx_lock(q->txq, smp_processor_id()); 2564 2565 2565 2566 reclaim_completed_tx(adap, &q->q, -1, true); 2566 2567 credits = txq_avail(&q->q) - ndesc; 2567 - if (unlikely(credits < 0)) 2568 + if (unlikely(credits < 0)) { 2569 + __netif_tx_unlock(q->txq); 2568 2570 return -ENOMEM; 2571 + } 2569 2572 2570 2573 wr = (void *)&q->q.desc[q->q.pidx]; 2571 2574 memset(wr, 0, sizeof(struct tx_desc)); ··· 2601 2598 init_completion(&lb->completion); 2602 2599 txq_advance(&q->q, ndesc); 2603 2600 cxgb4_ring_tx_db(adap, &q->q, ndesc); 2601 + __netif_tx_unlock(q->txq); 2604 2602 2605 2603 /* wait for the pkt to return */ 2606 2604 ret = wait_for_completion_timeout(&lb->completion, 10 * HZ);
+1 -3
drivers/net/ethernet/cortina/gemini.c
··· 2389 2389 2390 2390 dev_info(dev, "probe %s ID %d\n", dev_name(dev), id); 2391 2391 2392 - netdev = alloc_etherdev_mq(sizeof(*port), TX_QUEUE_NUM); 2392 + netdev = devm_alloc_etherdev_mqs(dev, sizeof(*port), TX_QUEUE_NUM, TX_QUEUE_NUM); 2393 2393 if (!netdev) { 2394 2394 dev_err(dev, "Can't allocate ethernet device #%d\n", id); 2395 2395 return -ENOMEM; ··· 2521 2521 } 2522 2522 2523 2523 port->netdev = NULL; 2524 - free_netdev(netdev); 2525 2524 return ret; 2526 2525 } 2527 2526 ··· 2529 2530 struct gemini_ethernet_port *port = platform_get_drvdata(pdev); 2530 2531 2531 2532 gemini_port_remove(port); 2532 - free_netdev(port->netdev); 2533 2533 return 0; 2534 2534 } 2535 2535
+3 -1
drivers/net/ethernet/freescale/gianfar.c
··· 750 750 continue; 751 751 752 752 err = gfar_parse_group(child, priv, model); 753 - if (err) 753 + if (err) { 754 + of_node_put(child); 754 755 goto err_grp_init; 756 + } 755 757 } 756 758 } else { /* SQ_SG_MODE */ 757 759 err = gfar_parse_group(np, priv, model);
+4 -4
drivers/net/ethernet/sfc/ef100.c
··· 142 142 143 143 /* Temporarily map new BAR. */ 144 144 rc = efx_init_io(efx, bar, 145 - DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 145 + (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 146 146 pci_resource_len(efx->pci_dev, bar)); 147 147 if (rc) { 148 148 netif_err(efx, probe, efx->net_dev, ··· 160 160 161 161 /* Put old BAR back. */ 162 162 rc = efx_init_io(efx, previous_bar, 163 - DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 163 + (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 164 164 pci_resource_len(efx->pci_dev, previous_bar)); 165 165 if (rc) { 166 166 netif_err(efx, probe, efx->net_dev, ··· 334 334 335 335 /* Temporarily map BAR. */ 336 336 rc = efx_init_io(efx, bar, 337 - DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 337 + (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 338 338 pci_resource_len(efx->pci_dev, bar)); 339 339 if (rc) { 340 340 netif_err(efx, probe, efx->net_dev, ··· 495 495 496 496 /* Set up basic I/O (BAR mappings etc) */ 497 497 rc = efx_init_io(efx, fcw.bar, 498 - DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 498 + (dma_addr_t)DMA_BIT_MASK(ESF_GZ_TX_SEND_ADDR_WIDTH), 499 499 pci_resource_len(efx->pci_dev, fcw.bar)); 500 500 if (rc) 501 501 goto fail;
+6 -4
drivers/net/ethernet/sfc/ef100_nic.c
··· 431 431 /* A RESET_TYPE_ALL will cause filters to be removed, so we remove filters 432 432 * and reprobe after reset to avoid removing filters twice 433 433 */ 434 - down_read(&efx->filter_sem); 434 + down_write(&efx->filter_sem); 435 435 ef100_filter_table_down(efx); 436 - up_read(&efx->filter_sem); 436 + up_write(&efx->filter_sem); 437 437 rc = efx_mcdi_reset(efx, reset_type); 438 438 if (rc) 439 439 return rc; 440 440 441 441 netif_device_attach(efx->net_dev); 442 442 443 - down_read(&efx->filter_sem); 443 + down_write(&efx->filter_sem); 444 444 rc = ef100_filter_table_up(efx); 445 - up_read(&efx->filter_sem); 445 + up_write(&efx->filter_sem); 446 446 if (rc) 447 447 return rc; 448 448 ··· 739 739 .rx_remove = efx_mcdi_rx_remove, 740 740 .rx_write = ef100_rx_write, 741 741 .rx_packet = __ef100_rx_packet, 742 + .rx_buf_hash_valid = ef100_rx_buf_hash_valid, 742 743 .fini_dmaq = efx_fini_dmaq, 743 744 .max_rx_ip_filters = EFX_MCDI_FILTER_TBL_ROWS, 744 745 .filter_table_probe = ef100_filter_table_up, ··· 821 820 .rx_remove = efx_mcdi_rx_remove, 822 821 .rx_write = ef100_rx_write, 823 822 .rx_packet = __ef100_rx_packet, 823 + .rx_buf_hash_valid = ef100_rx_buf_hash_valid, 824 824 .fini_dmaq = efx_fini_dmaq, 825 825 .max_rx_ip_filters = EFX_MCDI_FILTER_TBL_ROWS, 826 826 .filter_table_probe = ef100_filter_table_up,
+2
drivers/net/ethernet/sfc/net_driver.h
··· 846 846 * @timer_quantum_ns: Interrupt timer quantum, in nanoseconds 847 847 * @timer_max_ns: Interrupt timer maximum value, in nanoseconds 848 848 * @irq_rx_adaptive: Adaptive IRQ moderation enabled for RX event queues 849 + * @irqs_hooked: Channel interrupts are hooked 849 850 * @irq_rx_mod_step_us: Step size for IRQ moderation for RX event queues 850 851 * @irq_rx_moderation_us: IRQ moderation time for RX event queues 851 852 * @msg_enable: Log message enable flags ··· 1005 1004 unsigned int timer_quantum_ns; 1006 1005 unsigned int timer_max_ns; 1007 1006 bool irq_rx_adaptive; 1007 + bool irqs_hooked; 1008 1008 unsigned int irq_mod_step_us; 1009 1009 unsigned int irq_rx_moderation_us; 1010 1010 u32 msg_enable;
+4
drivers/net/ethernet/sfc/nic.c
··· 129 129 #endif 130 130 } 131 131 132 + efx->irqs_hooked = true; 132 133 return 0; 133 134 134 135 fail2: ··· 155 154 efx->net_dev->rx_cpu_rmap = NULL; 156 155 #endif 157 156 157 + if (!efx->irqs_hooked) 158 + return; 158 159 if (EFX_INT_MODE_USE_MSI(efx)) { 159 160 /* Disable MSI/MSI-X interrupts */ 160 161 efx_for_each_channel(channel, efx) ··· 166 163 /* Disable legacy interrupt */ 167 164 free_irq(efx->legacy_irq, efx); 168 165 } 166 + efx->irqs_hooked = false; 169 167 } 170 168 171 169 /* Register dump */
+1
drivers/net/ethernet/sfc/rx_common.c
··· 849 849 efx_for_each_channel(channel, efx) { 850 850 cancel_delayed_work_sync(&channel->filter_work); 851 851 kfree(channel->rps_flow_id); 852 + channel->rps_flow_id = NULL; 852 853 } 853 854 #endif 854 855 down_write(&efx->filter_sem);
+2 -2
drivers/net/hyperv/netvsc_drv.c
··· 367 367 } 368 368 rcu_read_unlock(); 369 369 370 - while (unlikely(txq >= ndev->real_num_tx_queues)) 370 + while (txq >= ndev->real_num_tx_queues) 371 371 txq -= ndev->real_num_tx_queues; 372 372 373 373 return txq; ··· 502 502 int rc; 503 503 504 504 skb->dev = vf_netdev; 505 - skb->queue_mapping = qdisc_skb_cb(skb)->slave_dev_queue_mapping; 505 + skb_record_rx_queue(skb, qdisc_skb_cb(skb)->slave_dev_queue_mapping); 506 506 507 507 rc = dev_queue_xmit(skb); 508 508 if (likely(rc == NET_XMIT_SUCCESS || rc == NET_XMIT_CN)) {
+17 -4
drivers/net/macvlan.c
··· 1269 1269 static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[], 1270 1270 struct netlink_ext_ack *extack) 1271 1271 { 1272 + struct nlattr *nla, *head; 1273 + int rem, len; 1274 + 1272 1275 if (tb[IFLA_ADDRESS]) { 1273 1276 if (nla_len(tb[IFLA_ADDRESS]) != ETH_ALEN) 1274 1277 return -EINVAL; ··· 1317 1314 1318 1315 if (!is_valid_ether_addr(nla_data(data[IFLA_MACVLAN_MACADDR]))) 1319 1316 return -EADDRNOTAVAIL; 1317 + } 1318 + 1319 + if (data[IFLA_MACVLAN_MACADDR_DATA]) { 1320 + head = nla_data(data[IFLA_MACVLAN_MACADDR_DATA]); 1321 + len = nla_len(data[IFLA_MACVLAN_MACADDR_DATA]); 1322 + 1323 + nla_for_each_attr(nla, head, len, rem) { 1324 + if (nla_type(nla) != IFLA_MACVLAN_MACADDR || 1325 + nla_len(nla) != ETH_ALEN) 1326 + return -EINVAL; 1327 + 1328 + if (!is_valid_ether_addr(nla_data(nla))) 1329 + return -EADDRNOTAVAIL; 1330 + } 1320 1331 } 1321 1332 1322 1333 if (data[IFLA_MACVLAN_MACADDR_COUNT]) ··· 1389 1372 len = nla_len(data[IFLA_MACVLAN_MACADDR_DATA]); 1390 1373 1391 1374 nla_for_each_attr(nla, head, len, rem) { 1392 - if (nla_type(nla) != IFLA_MACVLAN_MACADDR || 1393 - nla_len(nla) != ETH_ALEN) 1394 - continue; 1395 - 1396 1375 addr = nla_data(nla); 1397 1376 ret = macvlan_hash_add_source(vlan, addr); 1398 1377 if (ret)
+2 -2
drivers/net/phy/mscc/mscc_main.c
··· 1738 1738 return 0; 1739 1739 } 1740 1740 1741 - /* Trigger a read to the spcified MCB */ 1741 + /* Trigger a read to the specified MCB */ 1742 1742 static int phy_update_mcb_s6g(struct phy_device *phydev, u32 reg, u8 mcb) 1743 1743 { 1744 1744 return __phy_write_mcb_s6g(phydev, reg, mcb, PHY_MCB_S6G_READ); 1745 1745 } 1746 1746 1747 - /* Trigger a write to the spcified MCB */ 1747 + /* Trigger a write to the specified MCB */ 1748 1748 static int phy_commit_mcb_s6g(struct phy_device *phydev, u32 reg, u8 mcb) 1749 1749 { 1750 1750 return __phy_write_mcb_s6g(phydev, reg, mcb, PHY_MCB_S6G_WRITE);
+43 -13
drivers/ptp/ptp_clockmatrix.c
··· 142 142 return result; 143 143 } 144 144 145 - static int idtcm_xfer(struct idtcm *idtcm, 146 - u8 regaddr, 147 - u8 *buf, 148 - u16 count, 149 - bool write) 145 + static int idtcm_xfer_read(struct idtcm *idtcm, 146 + u8 regaddr, 147 + u8 *buf, 148 + u16 count) 150 149 { 151 150 struct i2c_client *client = idtcm->client; 152 151 struct i2c_msg msg[2]; 153 152 int cnt; 154 - char *fmt = "i2c_transfer failed at %d in %s for %s, at addr: %04X!\n"; 153 + char *fmt = "i2c_transfer failed at %d in %s, at addr: %04X!\n"; 155 154 156 155 msg[0].addr = client->addr; 157 156 msg[0].flags = 0; ··· 158 159 msg[0].buf = &regaddr; 159 160 160 161 msg[1].addr = client->addr; 161 - msg[1].flags = write ? 0 : I2C_M_RD; 162 + msg[1].flags = I2C_M_RD; 162 163 msg[1].len = count; 163 164 msg[1].buf = buf; 164 165 ··· 169 170 fmt, 170 171 __LINE__, 171 172 __func__, 172 - write ? "write" : "read", 173 173 regaddr); 174 174 return cnt; 175 175 } else if (cnt != 2) { 176 176 dev_err(&client->dev, 177 177 "i2c_transfer sent only %d of %d messages\n", cnt, 2); 178 178 return -EIO; 179 + } 180 + 181 + return 0; 182 + } 183 + 184 + static int idtcm_xfer_write(struct idtcm *idtcm, 185 + u8 regaddr, 186 + u8 *buf, 187 + u16 count) 188 + { 189 + struct i2c_client *client = idtcm->client; 190 + /* we add 1 byte for device register */ 191 + u8 msg[IDTCM_MAX_WRITE_COUNT + 1]; 192 + int cnt; 193 + char *fmt = "i2c_master_send failed at %d in %s, at addr: %04X!\n"; 194 + 195 + if (count > IDTCM_MAX_WRITE_COUNT) 196 + return -EINVAL; 197 + 198 + msg[0] = regaddr; 199 + memcpy(&msg[1], buf, count); 200 + 201 + cnt = i2c_master_send(client, msg, count + 1); 202 + 203 + if (cnt < 0) { 204 + dev_err(&client->dev, 205 + fmt, 206 + __LINE__, 207 + __func__, 208 + regaddr); 209 + return cnt; 179 210 } 180 211 181 212 return 0; ··· 224 195 buf[2] = 0x10; 225 196 buf[3] = 0x20; 226 197 227 - err = idtcm_xfer(idtcm, PAGE_ADDR, buf, sizeof(buf), 1); 198 + err = idtcm_xfer_write(idtcm, PAGE_ADDR, buf, sizeof(buf)); 228 199 229 200 if (err) { 230 201 idtcm->page_offset = 0xff; ··· 252 223 err = idtcm_page_offset(idtcm, hi); 253 224 254 225 if (err) 255 - goto out; 226 + return err; 256 227 257 - err = idtcm_xfer(idtcm, lo, buf, count, write); 258 - out: 259 - return err; 228 + if (write) 229 + return idtcm_xfer_write(idtcm, lo, buf, count); 230 + 231 + return idtcm_xfer_read(idtcm, lo, buf, count); 260 232 } 261 233 262 234 static int idtcm_read(struct idtcm *idtcm,
+2
drivers/ptp/ptp_clockmatrix.h
··· 55 55 56 56 #define PEROUT_ENABLE_OUTPUT_MASK (0xdeadbeef) 57 57 58 + #define IDTCM_MAX_WRITE_COUNT (512) 59 + 58 60 /* Values of DPLL_N.DPLL_MODE.PLL_MODE */ 59 61 enum pll_mode { 60 62 PLL_MODE_MIN = 0,
+2 -1
include/net/addrconf.h
··· 97 97 98 98 int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev); 99 99 100 - struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr); 100 + struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr, 101 + struct net_device *dev); 101 102 102 103 struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, 103 104 const struct in6_addr *addr,
+5 -5
include/uapi/linux/bpf.h
··· 767 767 * 768 768 * Also, note that **bpf_trace_printk**\ () is slow, and should 769 769 * only be used for debugging purposes. For this reason, a notice 770 - * bloc (spanning several lines) is printed to kernel logs and 770 + * block (spanning several lines) is printed to kernel logs and 771 771 * states that the helper should not be used "for production use" 772 772 * the first time this helper is used (or more precisely, when 773 773 * **trace_printk**\ () buffers are allocated). For passing values ··· 1033 1033 * 1034 1034 * int ret; 1035 1035 * struct bpf_tunnel_key key = {}; 1036 - * 1036 + * 1037 1037 * ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); 1038 1038 * if (ret < 0) 1039 1039 * return TC_ACT_SHOT; // drop packet 1040 - * 1040 + * 1041 1041 * if (key.remote_ipv4 != 0x0a000001) 1042 1042 * return TC_ACT_SHOT; // drop packet 1043 - * 1043 + * 1044 1044 * return TC_ACT_OK; // accept packet 1045 1045 * 1046 1046 * This interface can also be used with all encapsulation devices ··· 1147 1147 * Description 1148 1148 * Retrieve the realm or the route, that is to say the 1149 1149 * **tclassid** field of the destination for the *skb*. The 1150 - * indentifier retrieved is a user-provided tag, similar to the 1150 + * identifier retrieved is a user-provided tag, similar to the 1151 1151 * one used with the net_cls cgroup (see description for 1152 1152 * **bpf_get_cgroup_classid**\ () helper), but here this tag is 1153 1153 * held by a route (a destination entry), not by a task.
+14 -1
kernel/bpf/bpf_iter.c
··· 67 67 iter_priv->done_stop = true; 68 68 } 69 69 70 + /* maximum visited objects before bailing out */ 71 + #define MAX_ITER_OBJECTS 1000000 72 + 70 73 /* bpf_seq_read, a customized and simpler version for bpf iterator. 71 74 * no_llseek is assumed for this file. 72 75 * The following are differences from seq_read(): ··· 82 79 { 83 80 struct seq_file *seq = file->private_data; 84 81 size_t n, offs, copied = 0; 85 - int err = 0; 82 + int err = 0, num_objs = 0; 86 83 void *p; 87 84 88 85 mutex_lock(&seq->lock); ··· 138 135 while (1) { 139 136 loff_t pos = seq->index; 140 137 138 + num_objs++; 141 139 offs = seq->count; 142 140 p = seq->op->next(seq, p, &seq->index); 143 141 if (pos == seq->index) { ··· 156 152 157 153 if (seq->count >= size) 158 154 break; 155 + 156 + if (num_objs >= MAX_ITER_OBJECTS) { 157 + if (offs == 0) { 158 + err = -EAGAIN; 159 + seq->op->stop(seq, p); 160 + goto done; 161 + } 162 + break; 163 + } 159 164 160 165 err = seq->op->show(seq, p); 161 166 if (err > 0) {
+4 -2
kernel/bpf/task_iter.c
··· 29 29 30 30 rcu_read_lock(); 31 31 retry: 32 - pid = idr_get_next(&ns->idr, tid); 32 + pid = find_ge_pid(*tid, ns); 33 33 if (pid) { 34 + *tid = pid_nr_ns(pid, ns); 34 35 task = get_pid_task(pid, PIDTYPE_PID); 35 36 if (!task) { 36 37 ++*tid; ··· 179 178 f = fcheck_files(curr_files, curr_fd); 180 179 if (!f) 181 180 continue; 181 + if (!get_file_rcu(f)) 182 + continue; 182 183 183 184 /* set info->fd */ 184 185 info->fd = curr_fd; 185 - get_file(f); 186 186 rcu_read_unlock(); 187 187 return f; 188 188 }
+8 -6
net/core/dev.c
··· 8742 8742 int flags; 8743 8743 }; 8744 8744 8745 - static enum bpf_xdp_mode dev_xdp_mode(u32 flags) 8745 + static enum bpf_xdp_mode dev_xdp_mode(struct net_device *dev, u32 flags) 8746 8746 { 8747 8747 if (flags & XDP_FLAGS_HW_MODE) 8748 8748 return XDP_MODE_HW; 8749 8749 if (flags & XDP_FLAGS_DRV_MODE) 8750 8750 return XDP_MODE_DRV; 8751 - return XDP_MODE_SKB; 8751 + if (flags & XDP_FLAGS_SKB_MODE) 8752 + return XDP_MODE_SKB; 8753 + return dev->netdev_ops->ndo_bpf ? XDP_MODE_DRV : XDP_MODE_SKB; 8752 8754 } 8753 8755 8754 8756 static bpf_op_t dev_xdp_bpf_op(struct net_device *dev, enum bpf_xdp_mode mode) ··· 8898 8896 return -EINVAL; 8899 8897 } 8900 8898 8901 - mode = dev_xdp_mode(flags); 8899 + mode = dev_xdp_mode(dev, flags); 8902 8900 /* can't replace attached link */ 8903 8901 if (dev_xdp_link(dev, mode)) { 8904 8902 NL_SET_ERR_MSG(extack, "Can't replace active BPF XDP link"); ··· 8986 8984 8987 8985 ASSERT_RTNL(); 8988 8986 8989 - mode = dev_xdp_mode(link->flags); 8987 + mode = dev_xdp_mode(dev, link->flags); 8990 8988 if (dev_xdp_link(dev, mode) != link) 8991 8989 return -EINVAL; 8992 8990 ··· 9082 9080 goto out_unlock; 9083 9081 } 9084 9082 9085 - mode = dev_xdp_mode(xdp_link->flags); 9083 + mode = dev_xdp_mode(xdp_link->dev, xdp_link->flags); 9086 9084 bpf_op = dev_xdp_bpf_op(xdp_link->dev, mode); 9087 9085 err = dev_xdp_install(xdp_link->dev, mode, bpf_op, NULL, 9088 9086 xdp_link->flags, new_prog); ··· 9166 9164 int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, 9167 9165 int fd, int expected_fd, u32 flags) 9168 9166 { 9169 - enum bpf_xdp_mode mode = dev_xdp_mode(flags); 9167 + enum bpf_xdp_mode mode = dev_xdp_mode(dev, flags); 9170 9168 struct bpf_prog *new_prog = NULL, *old_prog = NULL; 9171 9169 int err; 9172 9170
+7 -3
net/core/skbuff.c
··· 5987 5987 if (skb_has_frag_list(skb)) 5988 5988 skb_clone_fraglist(skb); 5989 5989 5990 - if (k == 0) { 5991 - /* split line is in frag list */ 5992 - pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask); 5990 + /* split line is in frag list */ 5991 + if (k == 0 && pskb_carve_frag_list(skb, shinfo, off - pos, gfp_mask)) { 5992 + /* skb_frag_unref() is not needed here as shinfo->nr_frags = 0. */ 5993 + if (skb_has_frag_list(skb)) 5994 + kfree_skb_list(skb_shinfo(skb)->frag_list); 5995 + kfree(data); 5996 + return -ENOMEM; 5993 5997 } 5994 5998 skb_release_data(skb); 5995 5999
+10 -9
net/ethtool/features.c
··· 224 224 DECLARE_BITMAP(wanted_diff_mask, NETDEV_FEATURE_COUNT); 225 225 DECLARE_BITMAP(active_diff_mask, NETDEV_FEATURE_COUNT); 226 226 DECLARE_BITMAP(old_active, NETDEV_FEATURE_COUNT); 227 + DECLARE_BITMAP(old_wanted, NETDEV_FEATURE_COUNT); 227 228 DECLARE_BITMAP(new_active, NETDEV_FEATURE_COUNT); 229 + DECLARE_BITMAP(new_wanted, NETDEV_FEATURE_COUNT); 228 230 DECLARE_BITMAP(req_wanted, NETDEV_FEATURE_COUNT); 229 231 DECLARE_BITMAP(req_mask, NETDEV_FEATURE_COUNT); 230 232 struct nlattr *tb[ETHTOOL_A_FEATURES_MAX + 1]; ··· 252 250 253 251 rtnl_lock(); 254 252 ethnl_features_to_bitmap(old_active, dev->features); 253 + ethnl_features_to_bitmap(old_wanted, dev->wanted_features); 255 254 ret = ethnl_parse_bitset(req_wanted, req_mask, NETDEV_FEATURE_COUNT, 256 255 tb[ETHTOOL_A_FEATURES_WANTED], 257 256 netdev_features_strings, info->extack); ··· 264 261 goto out_rtnl; 265 262 } 266 263 267 - /* set req_wanted bits not in req_mask from old_active */ 264 + /* set req_wanted bits not in req_mask from old_wanted */ 268 265 bitmap_and(req_wanted, req_wanted, req_mask, NETDEV_FEATURE_COUNT); 269 - bitmap_andnot(new_active, old_active, req_mask, NETDEV_FEATURE_COUNT); 270 - bitmap_or(req_wanted, new_active, req_wanted, NETDEV_FEATURE_COUNT); 271 - if (bitmap_equal(req_wanted, old_active, NETDEV_FEATURE_COUNT)) { 272 - ret = 0; 273 - goto out_rtnl; 266 + bitmap_andnot(new_wanted, old_wanted, req_mask, NETDEV_FEATURE_COUNT); 267 + bitmap_or(req_wanted, new_wanted, req_wanted, NETDEV_FEATURE_COUNT); 268 + if (!bitmap_equal(req_wanted, old_wanted, NETDEV_FEATURE_COUNT)) { 269 + dev->wanted_features &= ~dev->hw_features; 270 + dev->wanted_features |= ethnl_bitmap_to_features(req_wanted) & dev->hw_features; 271 + __netdev_update_features(dev); 274 272 } 275 - 276 - dev->wanted_features = ethnl_bitmap_to_features(req_wanted); 277 - __netdev_update_features(dev); 278 273 ethnl_features_to_bitmap(new_active, dev->features); 279 274 mod = !bitmap_equal(old_active, new_active, NETDEV_FEATURE_COUNT); 280 275
+7 -7
net/ipv4/Kconfig
··· 661 661 662 662 BBR (Bottleneck Bandwidth and RTT) TCP congestion control aims to 663 663 maximize network utilization and minimize queues. It builds an explicit 664 - model of the the bottleneck delivery rate and path round-trip 665 - propagation delay. It tolerates packet loss and delay unrelated to 666 - congestion. It can operate over LAN, WAN, cellular, wifi, or cable 667 - modem links. It can coexist with flows that use loss-based congestion 668 - control, and can operate with shallow buffers, deep buffers, 669 - bufferbloat, policers, or AQM schemes that do not provide a delay 670 - signal. It requires the fq ("Fair Queue") pacing packet scheduler. 664 + model of the bottleneck delivery rate and path round-trip propagation 665 + delay. It tolerates packet loss and delay unrelated to congestion. It 666 + can operate over LAN, WAN, cellular, wifi, or cable modem links. It can 667 + coexist with flows that use loss-based congestion control, and can 668 + operate with shallow buffers, deep buffers, bufferbloat, policers, or 669 + AQM schemes that do not provide a delay signal. It requires the fq 670 + ("Fair Queue") pacing packet scheduler. 671 671 672 672 choice 673 673 prompt "Default TCP congestion control"
+4 -1
net/ipv4/nexthop.c
··· 446 446 unsigned int i, j; 447 447 u8 nhg_fdb = 0; 448 448 449 - if (len & (sizeof(struct nexthop_grp) - 1)) { 449 + if (!len || len & (sizeof(struct nexthop_grp) - 1)) { 450 450 NL_SET_ERR_MSG(extack, 451 451 "Invalid length for nexthop group attribute"); 452 452 return -EINVAL; ··· 1186 1186 struct nh_group *nhg; 1187 1187 struct nexthop *nh; 1188 1188 int i; 1189 + 1190 + if (WARN_ON(!num_nh)) 1191 + return ERR_PTR(-EINVAL); 1189 1192 1190 1193 nh = nexthop_alloc(); 1191 1194 if (!nh)
+23 -37
net/ipv6/addrconf.c
··· 1893 1893 * 2. does the address exist on the specific device 1894 1894 * (skip_dev_check = false) 1895 1895 */ 1896 - int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr, 1897 - const struct net_device *dev, bool skip_dev_check, 1898 - int strict, u32 banned_flags) 1896 + static struct net_device * 1897 + __ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr, 1898 + const struct net_device *dev, bool skip_dev_check, 1899 + int strict, u32 banned_flags) 1899 1900 { 1900 1901 unsigned int hash = inet6_addr_hash(net, addr); 1901 - const struct net_device *l3mdev; 1902 + struct net_device *l3mdev, *ndev; 1902 1903 struct inet6_ifaddr *ifp; 1903 1904 u32 ifp_flags; 1904 1905 ··· 1910 1909 dev = NULL; 1911 1910 1912 1911 hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) { 1913 - if (!net_eq(dev_net(ifp->idev->dev), net)) 1912 + ndev = ifp->idev->dev; 1913 + if (!net_eq(dev_net(ndev), net)) 1914 1914 continue; 1915 1915 1916 - if (l3mdev_master_dev_rcu(ifp->idev->dev) != l3mdev) 1916 + if (l3mdev_master_dev_rcu(ndev) != l3mdev) 1917 1917 continue; 1918 1918 1919 1919 /* Decouple optimistic from tentative for evaluation here. ··· 1925 1923 : ifp->flags; 1926 1924 if (ipv6_addr_equal(&ifp->addr, addr) && 1927 1925 !(ifp_flags&banned_flags) && 1928 - (!dev || ifp->idev->dev == dev || 1926 + (!dev || ndev == dev || 1929 1927 !(ifp->scope&(IFA_LINK|IFA_HOST) || strict))) { 1930 1928 rcu_read_unlock(); 1931 - return 1; 1929 + return ndev; 1932 1930 } 1933 1931 } 1934 1932 1935 1933 rcu_read_unlock(); 1936 - return 0; 1934 + return NULL; 1935 + } 1936 + 1937 + int ipv6_chk_addr_and_flags(struct net *net, const struct in6_addr *addr, 1938 + const struct net_device *dev, bool skip_dev_check, 1939 + int strict, u32 banned_flags) 1940 + { 1941 + return __ipv6_chk_addr_and_flags(net, addr, dev, skip_dev_check, 1942 + strict, banned_flags) ? 1 : 0; 1937 1943 } 1938 1944 EXPORT_SYMBOL(ipv6_chk_addr_and_flags); 1939 1945 ··· 2000 1990 * 2001 1991 * The caller should be protected by RCU, or RTNL. 2002 1992 */ 2003 - struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr) 1993 + struct net_device *ipv6_dev_find(struct net *net, const struct in6_addr *addr, 1994 + struct net_device *dev) 2004 1995 { 2005 - unsigned int hash = inet6_addr_hash(net, addr); 2006 - struct inet6_ifaddr *ifp, *result = NULL; 2007 - struct net_device *dev = NULL; 2008 - 2009 - rcu_read_lock(); 2010 - hlist_for_each_entry_rcu(ifp, &inet6_addr_lst[hash], addr_lst) { 2011 - if (net_eq(dev_net(ifp->idev->dev), net) && 2012 - ipv6_addr_equal(&ifp->addr, addr)) { 2013 - result = ifp; 2014 - break; 2015 - } 2016 - } 2017 - 2018 - if (!result) { 2019 - struct rt6_info *rt; 2020 - 2021 - rt = rt6_lookup(net, addr, NULL, 0, NULL, 0); 2022 - if (rt) { 2023 - dev = rt->dst.dev; 2024 - ip6_rt_put(rt); 2025 - } 2026 - } else { 2027 - dev = result->idev->dev; 2028 - } 2029 - rcu_read_unlock(); 2030 - 2031 - return dev; 1996 + return __ipv6_chk_addr_and_flags(net, addr, dev, !dev, 1, 1997 + IFA_F_TENTATIVE); 2032 1998 } 2033 1999 EXPORT_SYMBOL(ipv6_dev_find); 2034 2000
+9 -1
net/ipv6/ip6_tunnel.c
··· 915 915 struct metadata_dst *tun_dst, 916 916 bool log_ecn_err) 917 917 { 918 - return __ip6_tnl_rcv(t, skb, tpi, tun_dst, ip6ip6_dscp_ecn_decapsulate, 918 + int (*dscp_ecn_decapsulate)(const struct ip6_tnl *t, 919 + const struct ipv6hdr *ipv6h, 920 + struct sk_buff *skb); 921 + 922 + dscp_ecn_decapsulate = ip6ip6_dscp_ecn_decapsulate; 923 + if (tpi->proto == htons(ETH_P_IP)) 924 + dscp_ecn_decapsulate = ip4ip6_dscp_ecn_decapsulate; 925 + 926 + return __ip6_tnl_rcv(t, skb, tpi, tun_dst, dscp_ecn_decapsulate, 919 927 log_ecn_err); 920 928 } 921 929 EXPORT_SYMBOL(ip6_tnl_rcv);
+3
net/netlink/policy.c
··· 51 51 if (!state) 52 52 return -ENOMEM; 53 53 54 + memset(&state->policies[state->n_alloc], 0, 55 + flex_array_size(state, policies, n_alloc - state->n_alloc)); 56 + 54 57 state->policies[state->n_alloc].policy = policy; 55 58 state->policies[state->n_alloc].maxtype = maxtype; 56 59 state->n_alloc = n_alloc;
+1 -1
net/sched/act_ct.c
··· 704 704 err = ip_defrag(net, skb, user); 705 705 local_bh_enable(); 706 706 if (err && err != -EINPROGRESS) 707 - goto out_free; 707 + return err; 708 708 709 709 if (!err) { 710 710 *defrag = true;
+4 -2
net/sctp/stream.c
··· 88 88 int ret; 89 89 90 90 if (outcnt <= stream->outcnt) 91 - return 0; 91 + goto out; 92 92 93 93 ret = genradix_prealloc(&stream->out, outcnt, gfp); 94 94 if (ret) 95 95 return ret; 96 96 97 + out: 97 98 stream->outcnt = outcnt; 98 99 return 0; 99 100 } ··· 105 104 int ret; 106 105 107 106 if (incnt <= stream->incnt) 108 - return 0; 107 + goto out; 109 108 110 109 ret = genradix_prealloc(&stream->in, incnt, gfp); 111 110 if (ret) 112 111 return ret; 113 112 113 + out: 114 114 stream->incnt = incnt; 115 115 return 0; 116 116 }
+9 -7
net/smc/smc_diag.c
··· 170 170 (req->diag_ext & (1 << (SMC_DIAG_DMBINFO - 1))) && 171 171 !list_empty(&smc->conn.lgr->list)) { 172 172 struct smc_connection *conn = &smc->conn; 173 - struct smcd_diag_dmbinfo dinfo = { 174 - .linkid = *((u32 *)conn->lgr->id), 175 - .peer_gid = conn->lgr->peer_gid, 176 - .my_gid = conn->lgr->smcd->local_gid, 177 - .token = conn->rmb_desc->token, 178 - .peer_token = conn->peer_token 179 - }; 173 + struct smcd_diag_dmbinfo dinfo; 174 + 175 + memset(&dinfo, 0, sizeof(dinfo)); 176 + 177 + dinfo.linkid = *((u32 *)conn->lgr->id); 178 + dinfo.peer_gid = conn->lgr->peer_gid; 179 + dinfo.my_gid = conn->lgr->smcd->local_gid; 180 + dinfo.token = conn->rmb_desc->token; 181 + dinfo.peer_token = conn->peer_token; 180 182 181 183 if (nla_put(skb, SMC_DIAG_DMBINFO, sizeof(dinfo), &dinfo) < 0) 182 184 goto errout;
+2
net/tipc/crypto.c
··· 757 757 switch (err) { 758 758 case 0: 759 759 this_cpu_inc(tx->stats->stat[STAT_ASYNC_OK]); 760 + rcu_read_lock(); 760 761 if (likely(test_bit(0, &b->up))) 761 762 b->media->send_msg(net, skb, b, &tx_ctx->dst); 762 763 else 763 764 kfree_skb(skb); 765 + rcu_read_unlock(); 764 766 break; 765 767 case -EINPROGRESS: 766 768 return;
+3 -5
net/tipc/udp_media.c
··· 660 660 struct udp_tunnel_sock_cfg tuncfg = {NULL}; 661 661 struct nlattr *opts[TIPC_NLA_UDP_MAX + 1]; 662 662 u8 node_id[NODE_ID_LEN] = {0,}; 663 + struct net_device *dev; 663 664 int rmcast = 0; 664 665 665 666 ub = kzalloc(sizeof(*ub), GFP_ATOMIC); ··· 715 714 rcu_assign_pointer(ub->bearer, b); 716 715 tipc_udp_media_addr_set(&b->addr, &local); 717 716 if (local.proto == htons(ETH_P_IP)) { 718 - struct net_device *dev; 719 - 720 717 dev = __ip_dev_find(net, local.ipv4.s_addr, false); 721 718 if (!dev) { 722 719 err = -ENODEV; ··· 737 738 b->mtu = b->media->mtu; 738 739 #if IS_ENABLED(CONFIG_IPV6) 739 740 } else if (local.proto == htons(ETH_P_IPV6)) { 740 - struct net_device *dev; 741 - 742 - dev = ipv6_dev_find(net, &local.ipv6); 741 + dev = ub->ifindex ? __dev_get_by_index(net, ub->ifindex) : NULL; 742 + dev = ipv6_dev_find(net, &local.ipv6, dev); 743 743 if (!dev) { 744 744 err = -ENODEV; 745 745 goto err;
+2
tools/bpf/bpftool/pids.c
··· 134 134 while (true) { 135 135 ret = read(fd, buf, sizeof(buf)); 136 136 if (ret < 0) { 137 + if (errno == EAGAIN) 138 + continue; 137 139 err = -errno; 138 140 p_err("failed to read PID iterator output: %d", err); 139 141 goto out;
+36
tools/bpf/resolve_btfids/main.c
··· 233 233 return btf_id__add(root, id, false); 234 234 } 235 235 236 + /* 237 + * The data of compressed section should be aligned to 4 238 + * (for 32bit) or 8 (for 64 bit) bytes. The binutils ld 239 + * sets sh_addralign to 1, which makes libelf fail with 240 + * misaligned section error during the update: 241 + * FAILED elf_update(WRITE): invalid section alignment 242 + * 243 + * While waiting for ld fix, we fix the compressed sections 244 + * sh_addralign value manualy. 245 + */ 246 + static int compressed_section_fix(Elf *elf, Elf_Scn *scn, GElf_Shdr *sh) 247 + { 248 + int expected = gelf_getclass(elf) == ELFCLASS32 ? 4 : 8; 249 + 250 + if (!(sh->sh_flags & SHF_COMPRESSED)) 251 + return 0; 252 + 253 + if (sh->sh_addralign == expected) 254 + return 0; 255 + 256 + pr_debug2(" - fixing wrong alignment sh_addralign %u, expected %u\n", 257 + sh->sh_addralign, expected); 258 + 259 + sh->sh_addralign = expected; 260 + 261 + if (gelf_update_shdr(scn, sh) == 0) { 262 + printf("FAILED cannot update section header: %s\n", 263 + elf_errmsg(-1)); 264 + return -1; 265 + } 266 + return 0; 267 + } 268 + 236 269 static int elf_collect(struct object *obj) 237 270 { 238 271 Elf_Scn *scn = NULL; ··· 342 309 obj->efile.idlist_shndx = idx; 343 310 obj->efile.idlist_addr = sh.sh_addr; 344 311 } 312 + 313 + if (compressed_section_fix(elf, scn, &sh)) 314 + return -1; 345 315 } 346 316 347 317 return 0;
+5 -5
tools/include/uapi/linux/bpf.h
··· 767 767 * 768 768 * Also, note that **bpf_trace_printk**\ () is slow, and should 769 769 * only be used for debugging purposes. For this reason, a notice 770 - * bloc (spanning several lines) is printed to kernel logs and 770 + * block (spanning several lines) is printed to kernel logs and 771 771 * states that the helper should not be used "for production use" 772 772 * the first time this helper is used (or more precisely, when 773 773 * **trace_printk**\ () buffers are allocated). For passing values ··· 1033 1033 * 1034 1034 * int ret; 1035 1035 * struct bpf_tunnel_key key = {}; 1036 - * 1036 + * 1037 1037 * ret = bpf_skb_get_tunnel_key(skb, &key, sizeof(key), 0); 1038 1038 * if (ret < 0) 1039 1039 * return TC_ACT_SHOT; // drop packet 1040 - * 1040 + * 1041 1041 * if (key.remote_ipv4 != 0x0a000001) 1042 1042 * return TC_ACT_SHOT; // drop packet 1043 - * 1043 + * 1044 1044 * return TC_ACT_OK; // accept packet 1045 1045 * 1046 1046 * This interface can also be used with all encapsulation devices ··· 1147 1147 * Description 1148 1148 * Retrieve the realm or the route, that is to say the 1149 1149 * **tclassid** field of the destination for the *skb*. The 1150 - * indentifier retrieved is a user-provided tag, similar to the 1150 + * identifier retrieved is a user-provided tag, similar to the 1151 1151 * one used with the net_cls cgroup (see description for 1152 1152 * **bpf_get_cgroup_classid**\ () helper), but here this tag is 1153 1153 * held by a route (a destination entry), not by a task.
+1 -1
tools/lib/bpf/btf_dump.c
··· 879 879 btf_dump_printf(d, ": %d", m_sz); 880 880 off = m_off + m_sz; 881 881 } else { 882 - m_sz = max(0LL, btf__resolve_size(d->btf, m->type)); 882 + m_sz = max((__s64)0, btf__resolve_size(d->btf, m->type)); 883 883 off = m_off + m_sz * 8; 884 884 } 885 885 btf_dump_printf(d, ";");
+1 -1
tools/lib/bpf/libbpf.c
··· 2264 2264 data = elf_getdata(scn, NULL); 2265 2265 if (!scn || !data) { 2266 2266 pr_warn("failed to get Elf_Data from map section %d (%s)\n", 2267 - obj->efile.maps_shndx, MAPS_ELF_SEC); 2267 + obj->efile.btf_maps_shndx, MAPS_ELF_SEC); 2268 2268 return -EINVAL; 2269 2269 } 2270 2270
-1
tools/testing/selftests/bpf/.gitignore
··· 6 6 test_tag 7 7 FEATURE-DUMP.libbpf 8 8 fixdep 9 - test_align 10 9 test_dev_cgroup 11 10 /test_progs* 12 11 test_tcpbpf_user
+1 -1
tools/testing/selftests/bpf/Makefile
··· 32 32 33 33 # Order correspond to 'make run_tests' order 34 34 TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \ 35 - test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \ 35 + test_verifier_log test_dev_cgroup test_tcpbpf_user \ 36 36 test_sock test_btf test_sockmap get_cgroup_id_user test_socket_cookie \ 37 37 test_cgroup_storage \ 38 38 test_netcnt test_tcpnotify_user test_sock_fields test_sysctl \
+1 -1
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c
··· 19 19 log_buf = va_arg(args, char *); 20 20 if (!log_buf) 21 21 goto out; 22 - if (strstr(log_buf, err_str) == 0) 22 + if (err_str && strstr(log_buf, err_str) == 0) 23 23 found = true; 24 24 out: 25 25 printf(format, log_buf);