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 tag 'net-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net

Pull networking fixes from Jakub Kicinski:
"Including fixes from bluetooth and netfilter.

Current release - regressions:

- dsa: sja1105: fix reception from VLAN-unaware bridges

- Revert "net: stmmac: set PP_FLAG_DMA_SYNC_DEV only if XDP is
enabled"

- eth: fec: don't save PTP state if PTP is unsupported

Current release - new code bugs:

- smc: fix lack of icsk_syn_mss with IPPROTO_SMC, prevent null-deref

- eth: airoha: update Tx CPU DMA ring idx at the end of xmit loop

- phy: aquantia: AQR115c fix up PMA capabilities

Previous releases - regressions:

- tcp: 3 fixes for retrans_stamp and undo logic

Previous releases - always broken:

- net: do not delay dst_entries_add() in dst_release()

- netfilter: restrict xtables extensions to families that are safe,
syzbot found a way to combine ebtables with extensions that are
never used by userspace tools

- sctp: ensure sk_state is set to CLOSED if hashing fails in
sctp_listen_start

- mptcp: handle consistently DSS corruption, and prevent corruption
due to large pmtu xmit"

* tag 'net-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (87 commits)
MAINTAINERS: Add headers and mailing list to UDP section
MAINTAINERS: consistently exclude wireless files from NETWORKING [GENERAL]
slip: make slhc_remember() more robust against malicious packets
net/smc: fix lacks of icsk_syn_mss with IPPROTO_SMC
ppp: fix ppp_async_encode() illegal access
docs: netdev: document guidance on cleanup patches
phonet: Handle error of rtnl_register_module().
mpls: Handle error of rtnl_register_module().
mctp: Handle error of rtnl_register_module().
bridge: Handle error of rtnl_register_module().
vxlan: Handle error of rtnl_register_module().
rtnetlink: Add bulk registration helpers for rtnetlink message handlers.
net: do not delay dst_entries_add() in dst_release()
mptcp: pm: do not remove closing subflows
mptcp: fallback when MPTCP opts are dropped after 1st data
tcp: fix mptcp DSS corruption due to large pmtu xmit
mptcp: handle consistently DSS corruption
net: netconsole: fix wrong warning
net: dsa: refuse cross-chip mirroring operations
net: fec: don't save PTP state if PTP is unsupported
...

+1360 -509
+10 -10
Documentation/networking/tcp_ao.rst
··· 9 9 a Message Authentication Code (MAC). MACs are produced from the content 10 10 of a TCP segment using a hashing function with a password known to both peers. 11 11 The intent of TCP-AO is to deprecate TCP-MD5 providing better security, 12 - key rotation and support for variety of hashing algorithms. 12 + key rotation and support for a variety of hashing algorithms. 13 13 14 14 1. Introduction 15 15 =============== ··· 164 164 is not available, no action is required (RNextKeyID of a received 165 165 segment needs to match the MKT’s SendID). 166 166 167 - Q: How current_key is set and when does it change? It is a user-triggered 168 - change, or is it by a request from the remote peer? Is it set by the user 169 - explicitly, or by a matching rule? 167 + Q: How is current_key set, and when does it change? Is it a user-triggered 168 + change, or is it triggered by a request from the remote peer? Is it set by the 169 + user explicitly, or by a matching rule? 170 170 171 171 A: current_key is set by RNextKeyID [6.1]:: 172 172 ··· 233 233 234 234 Q: Can a non-TCP-AO connection become a TCP-AO-enabled one? 235 235 236 - A: No: for already established non-TCP-AO connection it would be impossible 237 - to switch using TCP-AO as the traffic key generation requires the initial 236 + A: No: for an already established non-TCP-AO connection it would be impossible 237 + to switch to using TCP-AO, as the traffic key generation requires the initial 238 238 sequence numbers. Paraphrasing, starting using TCP-AO would require 239 239 re-establishing the TCP connection. 240 240 ··· 292 292 293 293 Linux provides a set of ``setsockopt()s`` and ``getsockopt()s`` that let 294 294 userspace manage TCP-AO on a per-socket basis. In order to add/delete MKTs 295 - ``TCP_AO_ADD_KEY`` and ``TCP_AO_DEL_KEY`` TCP socket options must be used 295 + ``TCP_AO_ADD_KEY`` and ``TCP_AO_DEL_KEY`` TCP socket options must be used. 296 296 It is not allowed to add a key on an established non-TCP-AO connection 297 297 as well as to remove the last key from TCP-AO connection. 298 298 ··· 361 361 4. ``setsockopt()`` vs ``accept()`` race 362 362 ======================================== 363 363 364 - In contrast with TCP-MD5 established connection which has just one key, 364 + In contrast with an established TCP-MD5 connection which has just one key, 365 365 TCP-AO connections may have many keys, which means that accepted connections 366 366 on a listen socket may have any amount of keys as well. As copying all those 367 367 keys on a first properly signed SYN would make the request socket bigger, that ··· 374 374 hanging in the accept queue. 375 375 376 376 The reverse is valid as well: if userspace adds a new key for a peer on 377 - a listener socket, the established sockets in accept queue won't 377 + a listener socket, the established sockets in the accept queue won't 378 378 have the new keys. 379 379 380 380 At this moment, the resolution for the two races: ··· 382 382 and ``setsockopt(TCP_AO_DEL_KEY)`` vs ``accept()`` is delegated to userspace. 383 383 This means that it's expected that userspace would check the MKTs on the socket 384 384 that was returned by ``accept()`` to verify that any key rotation that 385 - happened on listen socket is reflected on the newly established connection. 385 + happened on the listen socket is reflected on the newly established connection. 386 386 387 387 This is a similar "do-nothing" approach to TCP-MD5 from the kernel side and 388 388 may be changed later by introducing new flags to ``tcp_ao_add``
+17
Documentation/process/maintainer-netdev.rst
··· 355 355 with better review coverage. Re-posting large series also increases the mailing 356 356 list traffic. 357 357 358 + .. _rcs: 359 + 358 360 Local variable ordering ("reverse xmas tree", "RCS") 359 361 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 360 362 ··· 392 390 APIs and helpers, especially scoped iterators. However, direct use of 393 391 ``__free()`` within networking core and drivers is discouraged. 394 392 Similar guidance applies to declaring variables mid-function. 393 + 394 + Clean-up patches 395 + ~~~~~~~~~~~~~~~~ 396 + 397 + Netdev discourages patches which perform simple clean-ups, which are not in 398 + the context of other work. For example: 399 + 400 + * Addressing ``checkpatch.pl`` warnings 401 + * Addressing :ref:`Local variable ordering<rcs>` issues 402 + * Conversions to device-managed APIs (``devm_`` helpers) 403 + 404 + This is because it is felt that the churn that such changes produce comes 405 + at a greater cost than the value of such clean-ups. 406 + 407 + Conversely, spelling and grammar fixes are not discouraged. 395 408 396 409 Resending after review 397 410 ~~~~~~~~~~~~~~~~~~~~~~
+17 -2
MAINTAINERS
··· 10270 10270 F: drivers/bus/hisi_lpc.c 10271 10271 10272 10272 HISILICON NETWORK SUBSYSTEM 3 DRIVER (HNS3) 10273 - M: Yisen Zhuang <yisen.zhuang@huawei.com> 10273 + M: Jian Shen <shenjian15@huawei.com> 10274 10274 M: Salil Mehta <salil.mehta@huawei.com> 10275 10275 M: Jijie Shao <shaojijie@huawei.com> 10276 10276 L: netdev@vger.kernel.org ··· 10279 10279 F: drivers/net/ethernet/hisilicon/hns3/ 10280 10280 10281 10281 HISILICON NETWORK SUBSYSTEM DRIVER 10282 - M: Yisen Zhuang <yisen.zhuang@huawei.com> 10282 + M: Jian Shen <shenjian15@huawei.com> 10283 10283 M: Salil Mehta <salil.mehta@huawei.com> 10284 10284 L: netdev@vger.kernel.org 10285 10285 S: Maintained ··· 16201 16201 F: net/ 16202 16202 F: tools/net/ 16203 16203 F: tools/testing/selftests/net/ 16204 + X: Documentation/networking/mac80211-injection.rst 16205 + X: Documentation/networking/mac80211_hwsim/ 16206 + X: Documentation/networking/regulatory.rst 16207 + X: include/net/cfg80211.h 16208 + X: include/net/ieee80211_radiotap.h 16209 + X: include/net/iw_handler.h 16210 + X: include/net/mac80211.h 16211 + X: include/net/wext.h 16204 16212 X: net/9p/ 16205 16213 X: net/bluetooth/ 16214 + X: net/mac80211/ 16215 + X: net/rfkill/ 16216 + X: net/wireless/ 16206 16217 16207 16218 NETWORKING [IPSEC] 16208 16219 M: Steffen Klassert <steffen.klassert@secunet.com> ··· 24188 24177 24189 24178 USER DATAGRAM PROTOCOL (UDP) 24190 24179 M: Willem de Bruijn <willemdebruijn.kernel@gmail.com> 24180 + L: netdev@vger.kernel.org 24191 24181 S: Maintained 24192 24182 F: include/linux/udp.h 24183 + F: include/net/udp.h 24184 + F: include/trace/events/udp.h 24185 + F: include/uapi/linux/udp.h 24193 24186 F: net/ipv4/udp.c 24194 24187 F: net/ipv6/udp.c 24195 24188
+18 -2
drivers/bluetooth/btusb.c
··· 4038 4038 static int btusb_suspend(struct usb_interface *intf, pm_message_t message) 4039 4039 { 4040 4040 struct btusb_data *data = usb_get_intfdata(intf); 4041 + int err; 4041 4042 4042 4043 BT_DBG("intf %p", intf); 4043 4044 4044 - /* Don't suspend if there are connections */ 4045 - if (hci_conn_count(data->hdev)) 4045 + /* Don't auto-suspend if there are connections; external suspend calls 4046 + * shall never fail. 4047 + */ 4048 + if (PMSG_IS_AUTO(message) && hci_conn_count(data->hdev)) 4046 4049 return -EBUSY; 4047 4050 4048 4051 if (data->suspend_count++) 4049 4052 return 0; 4053 + 4054 + /* Notify Host stack to suspend; this has to be done before stopping 4055 + * the traffic since the hci_suspend_dev itself may generate some 4056 + * traffic. 4057 + */ 4058 + err = hci_suspend_dev(data->hdev); 4059 + if (err) { 4060 + data->suspend_count--; 4061 + return err; 4062 + } 4050 4063 4051 4064 spin_lock_irq(&data->txlock); 4052 4065 if (!(PMSG_IS_AUTO(message) && data->tx_in_flight)) { ··· 4068 4055 } else { 4069 4056 spin_unlock_irq(&data->txlock); 4070 4057 data->suspend_count--; 4058 + hci_resume_dev(data->hdev); 4071 4059 return -EBUSY; 4072 4060 } 4073 4061 ··· 4188 4174 clear_bit(BTUSB_SUSPENDING, &data->flags); 4189 4175 spin_unlock_irq(&data->txlock); 4190 4176 schedule_work(&data->work); 4177 + 4178 + hci_resume_dev(data->hdev); 4191 4179 4192 4180 return 0; 4193 4181
+13 -4
drivers/net/dsa/b53/b53_common.c
··· 27 27 #include <linux/phylink.h> 28 28 #include <linux/etherdevice.h> 29 29 #include <linux/if_bridge.h> 30 + #include <linux/if_vlan.h> 30 31 #include <net/dsa.h> 31 32 32 33 #include "b53_regs.h" ··· 224 223 }; 225 224 226 225 #define B53_MIBS_58XX_SIZE ARRAY_SIZE(b53_mibs_58xx) 226 + 227 + #define B53_MAX_MTU_25 (1536 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) 228 + #define B53_MAX_MTU (9720 - ETH_HLEN - VLAN_HLEN - ETH_FCS_LEN) 227 229 228 230 static int b53_do_vlan_op(struct b53_device *dev, u8 op) 229 231 { ··· 2258 2254 bool allow_10_100; 2259 2255 2260 2256 if (is5325(dev) || is5365(dev)) 2261 - return -EOPNOTSUPP; 2257 + return 0; 2262 2258 2263 2259 if (!dsa_is_cpu_port(ds, port)) 2264 2260 return 0; 2265 2261 2266 - enable_jumbo = (mtu >= JMS_MIN_SIZE); 2267 - allow_10_100 = (dev->chip_id == BCM583XX_DEVICE_ID); 2262 + enable_jumbo = (mtu > ETH_DATA_LEN); 2263 + allow_10_100 = !is63xx(dev); 2268 2264 2269 2265 return b53_set_jumbo(dev, enable_jumbo, allow_10_100); 2270 2266 } 2271 2267 2272 2268 static int b53_get_max_mtu(struct dsa_switch *ds, int port) 2273 2269 { 2274 - return JMS_MAX_SIZE; 2270 + struct b53_device *dev = ds->priv; 2271 + 2272 + if (is5325(dev) || is5365(dev)) 2273 + return B53_MAX_MTU_25; 2274 + 2275 + return B53_MAX_MTU; 2275 2276 } 2276 2277 2277 2278 static const struct phylink_mac_ops b53_phylink_mac_ops = {
+29
drivers/net/dsa/lan9303-core.c
··· 6 6 #include <linux/module.h> 7 7 #include <linux/gpio/consumer.h> 8 8 #include <linux/regmap.h> 9 + #include <linux/iopoll.h> 9 10 #include <linux/mutex.h> 10 11 #include <linux/mii.h> 11 12 #include <linux/of.h> ··· 840 839 if (!chip->reset_gpio) 841 840 return; 842 841 842 + gpiod_set_value_cansleep(chip->reset_gpio, 1); 843 + 843 844 if (chip->reset_duration != 0) 844 845 msleep(chip->reset_duration); 845 846 ··· 867 864 static int lan9303_check_device(struct lan9303 *chip) 868 865 { 869 866 int ret; 867 + int err; 870 868 u32 reg; 869 + 870 + /* In I2C-managed configurations this polling loop will clash with 871 + * switch's reading of EEPROM right after reset and this behaviour is 872 + * not configurable. While lan9303_read() already has quite long retry 873 + * timeout, seems not all cases are being detected as arbitration error. 874 + * 875 + * According to datasheet, EEPROM loader has 30ms timeout (in case of 876 + * missing EEPROM). 877 + * 878 + * Loading of the largest supported EEPROM is expected to take at least 879 + * 5.9s. 880 + */ 881 + err = read_poll_timeout(lan9303_read, ret, 882 + !ret && reg & LAN9303_HW_CFG_READY, 883 + 20000, 6000000, false, 884 + chip->regmap, LAN9303_HW_CFG, &reg); 885 + if (ret) { 886 + dev_err(chip->dev, "failed to read HW_CFG reg: %pe\n", 887 + ERR_PTR(ret)); 888 + return ret; 889 + } 890 + if (err) { 891 + dev_err(chip->dev, "HW_CFG not ready: 0x%08x\n", reg); 892 + return err; 893 + } 871 894 872 895 ret = lan9303_read(chip->regmap, LAN9303_CHIP_REV, &reg); 873 896 if (ret) {
-1
drivers/net/dsa/sja1105/sja1105_main.c
··· 3158 3158 * TPID is ETH_P_SJA1105, and the VLAN ID is the port pvid. 3159 3159 */ 3160 3160 ds->vlan_filtering_is_global = true; 3161 - ds->untag_bridge_pvid = true; 3162 3161 ds->fdb_isolation = true; 3163 3162 ds->max_num_bridges = DSA_TAG_8021Q_MAX_NUM_BRIDGES; 3164 3163
+2 -2
drivers/net/ethernet/adi/adin1110.c
··· 318 318 * from the ADIN1110 frame header. 319 319 */ 320 320 if (frame_size < ADIN1110_FRAME_HEADER_LEN + ADIN1110_FEC_LEN) 321 - return ret; 321 + return -EINVAL; 322 322 323 323 round_len = adin1110_round_len(frame_size); 324 324 if (round_len < 0) 325 - return ret; 325 + return -EINVAL; 326 326 327 327 frame_size_no_fcs = frame_size - ADIN1110_FRAME_HEADER_LEN - ADIN1110_FEC_LEN; 328 328 memset(priv->data, 0, ADIN1110_RD_HEADER_LEN);
+3 -4
drivers/net/ethernet/amd/mvme147.c
··· 105 105 macaddr[3] = address&0xff; 106 106 eth_hw_addr_set(dev, macaddr); 107 107 108 - printk("%s: MVME147 at 0x%08lx, irq %d, Hardware Address %pM\n", 109 - dev->name, dev->base_addr, MVME147_LANCE_IRQ, 110 - dev->dev_addr); 111 - 112 108 lp = netdev_priv(dev); 113 109 lp->ram = __get_dma_pages(GFP_ATOMIC, 3); /* 32K */ 114 110 if (!lp->ram) { ··· 133 137 free_netdev(dev); 134 138 return ERR_PTR(err); 135 139 } 140 + 141 + netdev_info(dev, "MVME147 at 0x%08lx, irq %d, Hardware Address %pM\n", 142 + dev->base_addr, MVME147_LANCE_IRQ, dev->dev_addr); 136 143 137 144 return dev; 138 145 }
+6 -1
drivers/net/ethernet/faraday/ftgmac100.c
··· 1906 1906 goto err_phy_connect; 1907 1907 } 1908 1908 1909 - phydev = fixed_phy_register(PHY_POLL, &ncsi_phy_status, NULL); 1909 + phydev = fixed_phy_register(PHY_POLL, &ncsi_phy_status, np); 1910 + if (IS_ERR(phydev)) { 1911 + dev_err(&pdev->dev, "failed to register fixed PHY device\n"); 1912 + err = PTR_ERR(phydev); 1913 + goto err_phy_connect; 1914 + } 1910 1915 err = phy_connect_direct(netdev, phydev, ftgmac100_adjust_link, 1911 1916 PHY_INTERFACE_MODE_MII); 1912 1917 if (err) {
+4 -2
drivers/net/ethernet/freescale/fec_main.c
··· 1077 1077 u32 rcntl = OPT_FRAME_SIZE | 0x04; 1078 1078 u32 ecntl = FEC_ECR_ETHEREN; 1079 1079 1080 - fec_ptp_save_state(fep); 1080 + if (fep->bufdesc_ex) 1081 + fec_ptp_save_state(fep); 1081 1082 1082 1083 /* Whack a reset. We should wait for this. 1083 1084 * For i.MX6SX SOC, enet use AXI bus, we use disable MAC ··· 1341 1340 netdev_err(ndev, "Graceful transmit stop did not complete!\n"); 1342 1341 } 1343 1342 1344 - fec_ptp_save_state(fep); 1343 + if (fep->bufdesc_ex) 1344 + fec_ptp_save_state(fep); 1345 1345 1346 1346 /* Whack a reset. We should wait for this. 1347 1347 * For i.MX6SX SOC, enet use AXI bus, we use disable MAC
+3 -1
drivers/net/ethernet/ibm/emac/mal.c
··· 578 578 printk(KERN_ERR "%pOF: Support for 405EZ not enabled!\n", 579 579 ofdev->dev.of_node); 580 580 err = -ENODEV; 581 - goto fail; 581 + goto fail_unmap; 582 582 #endif 583 583 } 584 584 ··· 741 741 mal_reset(mal); 742 742 743 743 free_netdev(mal->dummy_dev); 744 + 745 + dcr_unmap(mal->dcr_host, 0x100); 744 746 745 747 dma_free_coherent(&ofdev->dev, 746 748 sizeof(struct mal_descriptor) *
+4 -2
drivers/net/ethernet/ibm/ibmvnic.c
··· 2472 2472 /* if we are going to send_subcrq_direct this then we need to 2473 2473 * update the checksum before copying the data into ltb. Essentially 2474 2474 * these packets force disable CSO so that we can guarantee that 2475 - * FW does not need header info and we can send direct. 2475 + * FW does not need header info and we can send direct. Also, vnic 2476 + * server must be able to xmit standard packets without header data 2476 2477 */ 2477 - if (!skb_is_gso(skb) && !ind_bufp->index && !netdev_xmit_more()) { 2478 + if (*hdrs == 0 && !skb_is_gso(skb) && 2479 + !ind_bufp->index && !netdev_xmit_more()) { 2478 2480 use_scrq_send_direct = true; 2479 2481 if (skb->ip_summed == CHECKSUM_PARTIAL && 2480 2482 skb_checksum_help(skb))
+2 -2
drivers/net/ethernet/intel/e1000e/hw.h
··· 108 108 #define E1000_DEV_ID_PCH_RPL_I219_V22 0x0DC8 109 109 #define E1000_DEV_ID_PCH_MTP_I219_LM18 0x550A 110 110 #define E1000_DEV_ID_PCH_MTP_I219_V18 0x550B 111 - #define E1000_DEV_ID_PCH_MTP_I219_LM19 0x550C 112 - #define E1000_DEV_ID_PCH_MTP_I219_V19 0x550D 111 + #define E1000_DEV_ID_PCH_ADP_I219_LM19 0x550C 112 + #define E1000_DEV_ID_PCH_ADP_I219_V19 0x550D 113 113 #define E1000_DEV_ID_PCH_LNP_I219_LM20 0x550E 114 114 #define E1000_DEV_ID_PCH_LNP_I219_V20 0x550F 115 115 #define E1000_DEV_ID_PCH_LNP_I219_LM21 0x5510
+2 -2
drivers/net/ethernet/intel/e1000e/netdev.c
··· 7899 7899 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V17), board_pch_adp }, 7900 7900 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_LM22), board_pch_adp }, 7901 7901 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_RPL_I219_V22), board_pch_adp }, 7902 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_LM19), board_pch_adp }, 7903 + { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_ADP_I219_V19), board_pch_adp }, 7902 7904 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM18), board_pch_mtp }, 7903 7905 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V18), board_pch_mtp }, 7904 - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_LM19), board_pch_mtp }, 7905 - { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_MTP_I219_V19), board_pch_mtp }, 7906 7906 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM20), board_pch_mtp }, 7907 7907 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_V20), board_pch_mtp }, 7908 7908 { PCI_VDEVICE(INTEL, E1000_DEV_ID_PCH_LNP_I219_LM21), board_pch_mtp },
+1
drivers/net/ethernet/intel/i40e/i40e_main.c
··· 1734 1734 struct hlist_node *h; 1735 1735 int bkt; 1736 1736 1737 + lockdep_assert_held(&vsi->mac_filter_hash_lock); 1737 1738 if (vsi->info.pvid) 1738 1739 return i40e_add_filter(vsi, macaddr, 1739 1740 le16_to_cpu(vsi->info.pvid));
+2
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
··· 2213 2213 vfres->vsi_res[0].qset_handle 2214 2214 = le16_to_cpu(vsi->info.qs_handle[0]); 2215 2215 if (!(vf->driver_caps & VIRTCHNL_VF_OFFLOAD_USO) && !vf->pf_set_mac) { 2216 + spin_lock_bh(&vsi->mac_filter_hash_lock); 2216 2217 i40e_del_mac_filter(vsi, vf->default_lan_addr.addr); 2217 2218 eth_zero_addr(vf->default_lan_addr.addr); 2219 + spin_unlock_bh(&vsi->mac_filter_hash_lock); 2218 2220 } 2219 2221 ether_addr_copy(vfres->vsi_res[0].default_mac_addr, 2220 2222 vf->default_lan_addr.addr);
+28 -30
drivers/net/ethernet/intel/ice/ice_ddp.c
··· 31 31 * Verifies various attributes of the package file, including length, format 32 32 * version, and the requirement of at least one segment. 33 33 */ 34 - static enum ice_ddp_state ice_verify_pkg(struct ice_pkg_hdr *pkg, u32 len) 34 + static enum ice_ddp_state ice_verify_pkg(const struct ice_pkg_hdr *pkg, u32 len) 35 35 { 36 36 u32 seg_count; 37 37 u32 i; ··· 57 57 /* all segments must fit within length */ 58 58 for (i = 0; i < seg_count; i++) { 59 59 u32 off = le32_to_cpu(pkg->seg_offset[i]); 60 - struct ice_generic_seg_hdr *seg; 60 + const struct ice_generic_seg_hdr *seg; 61 61 62 62 /* segment header must fit */ 63 63 if (len < off + sizeof(*seg)) 64 64 return ICE_DDP_PKG_INVALID_FILE; 65 65 66 - seg = (struct ice_generic_seg_hdr *)((u8 *)pkg + off); 66 + seg = (void *)pkg + off; 67 67 68 68 /* segment body must fit */ 69 69 if (len < off + le32_to_cpu(seg->seg_size)) ··· 119 119 * 120 120 * This helper function validates a buffer's header. 121 121 */ 122 - static struct ice_buf_hdr *ice_pkg_val_buf(struct ice_buf *buf) 122 + static const struct ice_buf_hdr *ice_pkg_val_buf(const struct ice_buf *buf) 123 123 { 124 - struct ice_buf_hdr *hdr; 124 + const struct ice_buf_hdr *hdr; 125 125 u16 section_count; 126 126 u16 data_end; 127 127 128 - hdr = (struct ice_buf_hdr *)buf->buf; 128 + hdr = (const struct ice_buf_hdr *)buf->buf; 129 129 /* verify data */ 130 130 section_count = le16_to_cpu(hdr->section_count); 131 131 if (section_count < ICE_MIN_S_COUNT || section_count > ICE_MAX_S_COUNT) ··· 165 165 * unexpected value has been detected (for example an invalid section count or 166 166 * an invalid buffer end value). 167 167 */ 168 - static struct ice_buf_hdr *ice_pkg_enum_buf(struct ice_seg *ice_seg, 169 - struct ice_pkg_enum *state) 168 + static const struct ice_buf_hdr *ice_pkg_enum_buf(struct ice_seg *ice_seg, 169 + struct ice_pkg_enum *state) 170 170 { 171 171 if (ice_seg) { 172 172 state->buf_table = ice_find_buf_table(ice_seg); ··· 1800 1800 * success it returns a pointer to the segment header, otherwise it will 1801 1801 * return NULL. 1802 1802 */ 1803 - static struct ice_generic_seg_hdr * 1803 + static const struct ice_generic_seg_hdr * 1804 1804 ice_find_seg_in_pkg(struct ice_hw *hw, u32 seg_type, 1805 - struct ice_pkg_hdr *pkg_hdr) 1805 + const struct ice_pkg_hdr *pkg_hdr) 1806 1806 { 1807 1807 u32 i; 1808 1808 ··· 1813 1813 1814 1814 /* Search all package segments for the requested segment type */ 1815 1815 for (i = 0; i < le32_to_cpu(pkg_hdr->seg_count); i++) { 1816 - struct ice_generic_seg_hdr *seg; 1816 + const struct ice_generic_seg_hdr *seg; 1817 1817 1818 - seg = (struct ice_generic_seg_hdr 1819 - *)((u8 *)pkg_hdr + 1820 - le32_to_cpu(pkg_hdr->seg_offset[i])); 1818 + seg = (void *)pkg_hdr + le32_to_cpu(pkg_hdr->seg_offset[i]); 1821 1819 1822 1820 if (le32_to_cpu(seg->seg_type) == seg_type) 1823 1821 return seg; ··· 2352 2354 * 2353 2355 * Return: zero when update was successful, negative values otherwise. 2354 2356 */ 2355 - int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len) 2357 + int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len) 2356 2358 { 2357 - u8 *current_topo, *new_topo = NULL; 2358 - struct ice_run_time_cfg_seg *seg; 2359 - struct ice_buf_hdr *section; 2360 - struct ice_pkg_hdr *pkg_hdr; 2359 + u8 *new_topo = NULL, *topo __free(kfree) = NULL; 2360 + const struct ice_run_time_cfg_seg *seg; 2361 + const struct ice_buf_hdr *section; 2362 + const struct ice_pkg_hdr *pkg_hdr; 2361 2363 enum ice_ddp_state state; 2362 2364 u16 offset, size = 0; 2363 2365 u32 reg = 0; ··· 2373 2375 return -EOPNOTSUPP; 2374 2376 } 2375 2377 2376 - current_topo = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL); 2377 - if (!current_topo) 2378 + topo = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL); 2379 + if (!topo) 2378 2380 return -ENOMEM; 2379 2381 2380 - /* Get the current Tx topology */ 2381 - status = ice_get_set_tx_topo(hw, current_topo, ICE_AQ_MAX_BUF_LEN, NULL, 2382 - &flags, false); 2383 - 2384 - kfree(current_topo); 2382 + /* Get the current Tx topology flags */ 2383 + status = ice_get_set_tx_topo(hw, topo, ICE_AQ_MAX_BUF_LEN, NULL, &flags, 2384 + false); 2385 2385 2386 2386 if (status) { 2387 2387 ice_debug(hw, ICE_DBG_INIT, "Get current topology is failed\n"); ··· 2415 2419 goto update_topo; 2416 2420 } 2417 2421 2418 - pkg_hdr = (struct ice_pkg_hdr *)buf; 2422 + pkg_hdr = (const struct ice_pkg_hdr *)buf; 2419 2423 state = ice_verify_pkg(pkg_hdr, len); 2420 2424 if (state) { 2421 2425 ice_debug(hw, ICE_DBG_INIT, "Failed to verify pkg (err: %d)\n", ··· 2424 2428 } 2425 2429 2426 2430 /* Find runtime configuration segment */ 2427 - seg = (struct ice_run_time_cfg_seg *) 2431 + seg = (const struct ice_run_time_cfg_seg *) 2428 2432 ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE_RUN_TIME_CFG, pkg_hdr); 2429 2433 if (!seg) { 2430 2434 ice_debug(hw, ICE_DBG_INIT, "5 layer topology segment is missing\n"); ··· 2457 2461 return -EIO; 2458 2462 } 2459 2463 2460 - /* Get the new topology buffer */ 2461 - new_topo = ((u8 *)section) + offset; 2464 + /* Get the new topology buffer, reuse current topo copy mem */ 2465 + static_assert(ICE_PKG_BUF_SIZE == ICE_AQ_MAX_BUF_LEN); 2466 + new_topo = topo; 2467 + memcpy(new_topo, (u8 *)section + offset, size); 2462 2468 2463 2469 update_topo: 2464 2470 /* Acquire global lock to make sure that set topology issued
+2 -2
drivers/net/ethernet/intel/ice/ice_ddp.h
··· 438 438 u32 buf_idx; 439 439 440 440 u32 type; 441 - struct ice_buf_hdr *buf; 441 + const struct ice_buf_hdr *buf; 442 442 u32 sect_idx; 443 443 void *sect; 444 444 u32 sect_type; ··· 467 467 void *ice_pkg_enum_section(struct ice_seg *ice_seg, struct ice_pkg_enum *state, 468 468 u32 sect_type); 469 469 470 - int ice_cfg_tx_topo(struct ice_hw *hw, u8 *buf, u32 len); 470 + int ice_cfg_tx_topo(struct ice_hw *hw, const void *buf, u32 len); 471 471 472 472 #endif
+4 -2
drivers/net/ethernet/intel/ice/ice_dpll.c
··· 656 656 struct ice_dpll_pin *p = pin_priv; 657 657 struct ice_dpll *d = dpll_priv; 658 658 659 + if (state == DPLL_PIN_STATE_SELECTABLE) 660 + return -EINVAL; 659 661 if (!enable && p->state[d->dpll_idx] == DPLL_PIN_STATE_DISCONNECTED) 660 662 return 0; 661 663 ··· 1845 1843 struct dpll_pin *parent; 1846 1844 int ret, i; 1847 1845 1846 + if (WARN_ON((!vsi || !vsi->netdev))) 1847 + return -EINVAL; 1848 1848 ret = ice_dpll_get_pins(pf, pin, start_idx, ICE_DPLL_RCLK_NUM_PER_PF, 1849 1849 pf->dplls.clock_id); 1850 1850 if (ret) ··· 1862 1858 if (ret) 1863 1859 goto unregister_pins; 1864 1860 } 1865 - if (WARN_ON((!vsi || !vsi->netdev))) 1866 - return -EINVAL; 1867 1861 dpll_netdev_pin_set(vsi->netdev, pf->dplls.rclk.pin); 1868 1862 1869 1863 return 0;
+4 -1
drivers/net/ethernet/intel/ice/ice_eswitch_br.c
··· 582 582 return NOTIFY_DONE; 583 583 } 584 584 585 - static void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge) 585 + void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge) 586 586 { 587 587 struct ice_esw_br_fdb_entry *entry, *tmp; 588 + 589 + if (!bridge) 590 + return; 588 591 589 592 list_for_each_entry_safe(entry, tmp, &bridge->fdb_list, list) 590 593 ice_eswitch_br_fdb_entry_notify_and_cleanup(bridge, entry);
+1
drivers/net/ethernet/intel/ice/ice_eswitch_br.h
··· 117 117 ice_eswitch_br_offloads_deinit(struct ice_pf *pf); 118 118 int 119 119 ice_eswitch_br_offloads_init(struct ice_pf *pf); 120 + void ice_eswitch_br_fdb_flush(struct ice_esw_br *bridge); 120 121 121 122 #endif /* _ICE_ESWITCH_BR_H_ */
+7 -32
drivers/net/ethernet/intel/ice/ice_main.c
··· 87 87 88 88 bool netif_is_ice(const struct net_device *dev) 89 89 { 90 - return dev && (dev->netdev_ops == &ice_netdev_ops); 90 + return dev && (dev->netdev_ops == &ice_netdev_ops || 91 + dev->netdev_ops == &ice_netdev_safe_mode_ops); 91 92 } 92 93 93 94 /** ··· 522 521 } 523 522 524 523 /** 525 - * ice_clear_sw_switch_recipes - clear switch recipes 526 - * @pf: board private structure 527 - * 528 - * Mark switch recipes as not created in sw structures. There are cases where 529 - * rules (especially advanced rules) need to be restored, either re-read from 530 - * hardware or added again. For example after the reset. 'recp_created' flag 531 - * prevents from doing that and need to be cleared upfront. 532 - */ 533 - static void ice_clear_sw_switch_recipes(struct ice_pf *pf) 534 - { 535 - struct ice_sw_recipe *recp; 536 - u8 i; 537 - 538 - recp = pf->hw.switch_info->recp_list; 539 - for (i = 0; i < ICE_MAX_NUM_RECIPES; i++) 540 - recp[i].recp_created = false; 541 - } 542 - 543 - /** 544 524 * ice_prepare_for_reset - prep for reset 545 525 * @pf: board private structure 546 526 * @reset_type: reset type requested ··· 557 575 mutex_unlock(&pf->vfs.table_lock); 558 576 559 577 if (ice_is_eswitch_mode_switchdev(pf)) { 560 - if (reset_type != ICE_RESET_PFR) 561 - ice_clear_sw_switch_recipes(pf); 578 + rtnl_lock(); 579 + ice_eswitch_br_fdb_flush(pf->eswitch.br_offloads->bridge); 580 + rtnl_unlock(); 562 581 } 563 582 564 583 /* release ADQ specific HW and SW resources */ ··· 4519 4536 u8 num_tx_sched_layers = hw->num_tx_sched_layers; 4520 4537 struct ice_pf *pf = hw->back; 4521 4538 struct device *dev; 4522 - u8 *buf_copy; 4523 4539 int err; 4524 4540 4525 4541 dev = ice_pf_to_dev(pf); 4526 - /* ice_cfg_tx_topo buf argument is not a constant, 4527 - * so we have to make a copy 4528 - */ 4529 - buf_copy = kmemdup(firmware->data, firmware->size, GFP_KERNEL); 4530 - 4531 - err = ice_cfg_tx_topo(hw, buf_copy, firmware->size); 4542 + err = ice_cfg_tx_topo(hw, firmware->data, firmware->size); 4532 4543 if (!err) { 4533 4544 if (hw->num_tx_sched_layers > num_tx_sched_layers) 4534 4545 dev_info(dev, "Tx scheduling layers switching feature disabled\n"); ··· 4750 4773 ice_init_feature_support(pf); 4751 4774 4752 4775 err = ice_init_ddp_config(hw, pf); 4753 - if (err) 4754 - return err; 4755 4776 4756 4777 /* if ice_init_ddp_config fails, ICE_FLAG_ADV_FEATURES bit won't be 4757 4778 * set in pf->state, which will cause ice_is_safe_mode to return 4758 4779 * true 4759 4780 */ 4760 - if (ice_is_safe_mode(pf)) { 4781 + if (err || ice_is_safe_mode(pf)) { 4761 4782 /* we already got function/device capabilities but these don't 4762 4783 * reflect what the driver needs to do in safe mode. Instead of 4763 4784 * adding conditional logic everywhere to ignore these
+14 -5
drivers/net/ethernet/intel/ice/ice_sriov.c
··· 1096 1096 return -ENOENT; 1097 1097 1098 1098 vsi = ice_get_vf_vsi(vf); 1099 - if (!vsi) 1099 + if (!vsi) { 1100 + ice_put_vf(vf); 1100 1101 return -ENOENT; 1102 + } 1101 1103 1102 1104 prev_msix = vf->num_msix; 1103 1105 prev_queues = vf->num_vf_qs; ··· 1121 1119 if (vf->first_vector_idx < 0) 1122 1120 goto unroll; 1123 1121 1124 - if (ice_vf_reconfig_vsi(vf) || ice_vf_init_host_cfg(vf, vsi)) { 1122 + vsi->req_txq = queues; 1123 + vsi->req_rxq = queues; 1124 + 1125 + if (ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT)) { 1125 1126 /* Try to rebuild with previous values */ 1126 1127 needs_rebuild = true; 1127 1128 goto unroll; ··· 1147 1142 vf->num_msix = prev_msix; 1148 1143 vf->num_vf_qs = prev_queues; 1149 1144 vf->first_vector_idx = ice_sriov_get_irqs(pf, vf->num_msix); 1150 - if (vf->first_vector_idx < 0) 1145 + if (vf->first_vector_idx < 0) { 1146 + ice_put_vf(vf); 1151 1147 return -EINVAL; 1148 + } 1152 1149 1153 1150 if (needs_rebuild) { 1154 - ice_vf_reconfig_vsi(vf); 1155 - ice_vf_init_host_cfg(vf, vsi); 1151 + vsi->req_txq = prev_queues; 1152 + vsi->req_rxq = prev_queues; 1153 + 1154 + ice_vsi_rebuild(vsi, ICE_VSI_FLAG_NO_INIT); 1156 1155 } 1157 1156 1158 1157 ice_ena_vf_mappings(vf);
-2
drivers/net/ethernet/intel/ice/ice_switch.c
··· 6322 6322 if (!itr->vsi_list_info || 6323 6323 !test_bit(vsi_handle, itr->vsi_list_info->vsi_map)) 6324 6324 continue; 6325 - /* Clearing it so that the logic can add it back */ 6326 - clear_bit(vsi_handle, itr->vsi_list_info->vsi_map); 6327 6325 f_entry.fltr_info.vsi_handle = vsi_handle; 6328 6326 f_entry.fltr_info.fltr_act = ICE_FWD_TO_VSI; 6329 6327 /* update the src in case it is VSI num */
+11
drivers/net/ethernet/intel/ice/ice_tc_lib.c
··· 819 819 rule_info.sw_act.flag |= ICE_FLTR_TX; 820 820 rule_info.sw_act.src = vsi->idx; 821 821 rule_info.flags_info.act = ICE_SINGLE_ACT_LAN_ENABLE; 822 + /* This is a specific case. The destination VSI index is 823 + * overwritten by the source VSI index. This type of filter 824 + * should allow the packet to go to the LAN, not to the 825 + * VSI passed here. It should set LAN_EN bit only. However, 826 + * the VSI must be a valid one. Setting source VSI index 827 + * here is safe. Even if the result from switch is set LAN_EN 828 + * and LB_EN (which normally will pass the packet to this VSI) 829 + * packet won't be seen on the VSI, because local loopback is 830 + * turned off. 831 + */ 832 + rule_info.sw_act.vsi_handle = vsi->idx; 822 833 } else { 823 834 /* VF to VF */ 824 835 rule_info.sw_act.flag |= ICE_FLTR_TX;
+8 -1
drivers/net/ethernet/intel/ice/ice_vf_lib.c
··· 256 256 * 257 257 * It brings the VSI down and then reconfigures it with the hardware. 258 258 */ 259 - int ice_vf_reconfig_vsi(struct ice_vf *vf) 259 + static int ice_vf_reconfig_vsi(struct ice_vf *vf) 260 260 { 261 261 struct ice_vsi *vsi = ice_get_vf_vsi(vf); 262 262 struct ice_pf *pf = vf->pf; ··· 335 335 336 336 err = vlan_ops->add_vlan(vsi, &vf->port_vlan_info); 337 337 } else { 338 + /* clear possible previous port vlan config */ 339 + err = ice_vsi_clear_port_vlan(vsi); 340 + if (err) { 341 + dev_err(dev, "failed to clear port VLAN via VSI parameters for VF %u, error %d\n", 342 + vf->vf_id, err); 343 + return err; 344 + } 338 345 err = ice_vsi_add_vlan_zero(vsi); 339 346 } 340 347
-1
drivers/net/ethernet/intel/ice/ice_vf_lib_private.h
··· 23 23 #warning "Only include ice_vf_lib_private.h in CONFIG_PCI_IOV virtualization files" 24 24 #endif 25 25 26 - int ice_vf_reconfig_vsi(struct ice_vf *vf); 27 26 void ice_initialize_vf_entry(struct ice_vf *vf); 28 27 void ice_dis_vf_qs(struct ice_vf *vf); 29 28 int ice_check_vf_init(struct ice_vf *vf);
+57
drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
··· 787 787 kfree(ctxt); 788 788 return err; 789 789 } 790 + 791 + int ice_vsi_clear_port_vlan(struct ice_vsi *vsi) 792 + { 793 + struct ice_hw *hw = &vsi->back->hw; 794 + struct ice_vsi_ctx *ctxt; 795 + int err; 796 + 797 + ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); 798 + if (!ctxt) 799 + return -ENOMEM; 800 + 801 + ctxt->info = vsi->info; 802 + 803 + ctxt->info.port_based_outer_vlan = 0; 804 + ctxt->info.port_based_inner_vlan = 0; 805 + 806 + ctxt->info.inner_vlan_flags = 807 + FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_TX_MODE_M, 808 + ICE_AQ_VSI_INNER_VLAN_TX_MODE_ALL); 809 + if (ice_is_dvm_ena(hw)) { 810 + ctxt->info.inner_vlan_flags |= 811 + FIELD_PREP(ICE_AQ_VSI_INNER_VLAN_EMODE_M, 812 + ICE_AQ_VSI_INNER_VLAN_EMODE_NOTHING); 813 + ctxt->info.outer_vlan_flags = 814 + FIELD_PREP(ICE_AQ_VSI_OUTER_VLAN_TX_MODE_M, 815 + ICE_AQ_VSI_OUTER_VLAN_TX_MODE_ALL); 816 + ctxt->info.outer_vlan_flags |= 817 + FIELD_PREP(ICE_AQ_VSI_OUTER_TAG_TYPE_M, 818 + ICE_AQ_VSI_OUTER_TAG_VLAN_8100); 819 + ctxt->info.outer_vlan_flags |= 820 + ICE_AQ_VSI_OUTER_VLAN_EMODE_NOTHING << 821 + ICE_AQ_VSI_OUTER_VLAN_EMODE_S; 822 + } 823 + 824 + ctxt->info.sw_flags2 &= ~ICE_AQ_VSI_SW_FLAG_RX_VLAN_PRUNE_ENA; 825 + ctxt->info.valid_sections = 826 + cpu_to_le16(ICE_AQ_VSI_PROP_OUTER_TAG_VALID | 827 + ICE_AQ_VSI_PROP_VLAN_VALID | 828 + ICE_AQ_VSI_PROP_SW_VALID); 829 + 830 + err = ice_update_vsi(hw, vsi->idx, ctxt, NULL); 831 + if (err) { 832 + dev_err(ice_pf_to_dev(vsi->back), "update VSI for clearing port based VLAN failed, err %d aq_err %s\n", 833 + err, ice_aq_str(hw->adminq.sq_last_status)); 834 + } else { 835 + vsi->info.port_based_outer_vlan = 836 + ctxt->info.port_based_outer_vlan; 837 + vsi->info.port_based_inner_vlan = 838 + ctxt->info.port_based_inner_vlan; 839 + vsi->info.outer_vlan_flags = ctxt->info.outer_vlan_flags; 840 + vsi->info.inner_vlan_flags = ctxt->info.inner_vlan_flags; 841 + vsi->info.sw_flags2 = ctxt->info.sw_flags2; 842 + } 843 + 844 + kfree(ctxt); 845 + return err; 846 + }
+1
drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.h
··· 36 36 int ice_vsi_dis_outer_insertion(struct ice_vsi *vsi); 37 37 int ice_vsi_set_outer_port_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan); 38 38 int ice_vsi_clear_outer_port_vlan(struct ice_vsi *vsi); 39 + int ice_vsi_clear_port_vlan(struct ice_vsi *vsi); 39 40 40 41 #endif /* _ICE_VSI_VLAN_LIB_H_ */
+1
drivers/net/ethernet/intel/idpf/idpf_vf_dev.c
··· 99 99 intr->dyn_ctl_intena_m = VF_INT_DYN_CTLN_INTENA_M; 100 100 intr->dyn_ctl_intena_msk_m = VF_INT_DYN_CTLN_INTENA_MSK_M; 101 101 intr->dyn_ctl_itridx_s = VF_INT_DYN_CTLN_ITR_INDX_S; 102 + intr->dyn_ctl_intrvl_s = VF_INT_DYN_CTLN_INTERVAL_S; 102 103 intr->dyn_ctl_wb_on_itr_m = VF_INT_DYN_CTLN_WB_ON_ITR_M; 103 104 104 105 spacing = IDPF_ITR_IDX_SPACING(reg_vals[vec_id].itrn_index_spacing,
+2 -9
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
··· 666 666 667 667 if (ctlq_msg->data_len) { 668 668 payload = ctlq_msg->ctx.indirect.payload->va; 669 - payload_size = ctlq_msg->ctx.indirect.payload->size; 669 + payload_size = ctlq_msg->data_len; 670 670 } 671 671 672 672 xn->reply_sz = payload_size; ··· 1293 1293 reply_sz = idpf_vc_xn_exec(adapter, &xn_params); 1294 1294 if (reply_sz < 0) { 1295 1295 err = reply_sz; 1296 - goto free_vport_params; 1297 - } 1298 - if (reply_sz < IDPF_CTLQ_MAX_BUF_LEN) { 1299 - err = -EIO; 1300 1296 goto free_vport_params; 1301 1297 } 1302 1298 ··· 2598 2602 if (reply_sz < 0) 2599 2603 return reply_sz; 2600 2604 2601 - if (reply_sz < IDPF_CTLQ_MAX_BUF_LEN) 2602 - return -EIO; 2603 - 2604 2605 ptypes_recvd += le16_to_cpu(ptype_info->num_ptypes); 2605 2606 if (ptypes_recvd > max_ptype) 2606 2607 return -EINVAL; ··· 3081 3088 if (!test_bit(IDPF_VC_CORE_INIT, adapter->flags)) 3082 3089 return; 3083 3090 3084 - idpf_vc_xn_shutdown(adapter->vcxn_mngr); 3085 3091 idpf_deinit_task(adapter); 3086 3092 idpf_intr_rel(adapter); 3093 + idpf_vc_xn_shutdown(adapter->vcxn_mngr); 3087 3094 3088 3095 cancel_delayed_work_sync(&adapter->serv_task); 3089 3096 cancel_delayed_work_sync(&adapter->mbx_task);
+4
drivers/net/ethernet/intel/igb/igb_main.c
··· 9651 9651 struct igb_adapter *adapter = netdev_priv(netdev); 9652 9652 9653 9653 if (netif_running(netdev)) { 9654 + if (!test_bit(__IGB_DOWN, &adapter->state)) { 9655 + dev_dbg(&pdev->dev, "Resuming from non-fatal error, do nothing.\n"); 9656 + return; 9657 + } 9654 9658 if (igb_up(adapter)) { 9655 9659 dev_err(&pdev->dev, "igb_up failed after reset\n"); 9656 9660 return;
+5 -4
drivers/net/ethernet/mediatek/airoha_eth.c
··· 2471 2471 e->dma_addr = addr; 2472 2472 e->dma_len = len; 2473 2473 2474 - airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), 2475 - TX_RING_CPU_IDX_MASK, 2476 - FIELD_PREP(TX_RING_CPU_IDX_MASK, index)); 2477 - 2478 2474 data = skb_frag_address(frag); 2479 2475 len = skb_frag_size(frag); 2480 2476 } ··· 2479 2483 q->queued += i; 2480 2484 2481 2485 skb_tx_timestamp(skb); 2486 + if (!netdev_xmit_more()) 2487 + airoha_qdma_rmw(qdma, REG_TX_CPU_IDX(qid), 2488 + TX_RING_CPU_IDX_MASK, 2489 + FIELD_PREP(TX_RING_CPU_IDX_MASK, q->head)); 2490 + 2482 2491 if (q->ndesc - q->queued < q->free_thr) 2483 2492 netif_tx_stop_queue(txq); 2484 2493
+2 -1
drivers/net/ethernet/sfc/efx_channels.c
··· 1260 1260 1261 1261 spent = efx_process_channel(channel, budget); 1262 1262 1263 - xdp_do_flush(); 1263 + if (budget) 1264 + xdp_do_flush(); 1264 1265 1265 1266 if (spent < budget) { 1266 1267 if (efx_channel_has_rx_queue(channel) &&
+2 -1
drivers/net/ethernet/sfc/siena/efx_channels.c
··· 1285 1285 1286 1286 spent = efx_process_channel(channel, budget); 1287 1287 1288 - xdp_do_flush(); 1288 + if (budget) 1289 + xdp_do_flush(); 1289 1290 1290 1291 if (spent < budget) { 1291 1292 if (efx_channel_has_rx_queue(channel) &&
+1 -1
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 2035 2035 rx_q->queue_index = queue; 2036 2036 rx_q->priv_data = priv; 2037 2037 2038 - pp_params.flags = PP_FLAG_DMA_MAP | (xdp_prog ? PP_FLAG_DMA_SYNC_DEV : 0); 2038 + pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; 2039 2039 pp_params.pool_size = dma_conf->dma_rx_size; 2040 2040 num_pages = DIV_ROUND_UP(dma_conf->dma_buf_sz, PAGE_SIZE); 2041 2041 pp_params.order = ilog2(num_pages);
+13 -9
drivers/net/ethernet/ti/am65-cpsw-nuss.c
··· 2744 2744 return 0; 2745 2745 2746 2746 /* alloc netdev */ 2747 - port->ndev = devm_alloc_etherdev_mqs(common->dev, 2748 - sizeof(struct am65_cpsw_ndev_priv), 2749 - AM65_CPSW_MAX_QUEUES, 2750 - AM65_CPSW_MAX_QUEUES); 2747 + port->ndev = alloc_etherdev_mqs(sizeof(struct am65_cpsw_ndev_priv), 2748 + AM65_CPSW_MAX_QUEUES, 2749 + AM65_CPSW_MAX_QUEUES); 2751 2750 if (!port->ndev) { 2752 2751 dev_err(dev, "error allocating slave net_device %u\n", 2753 2752 port->port_id); ··· 2867 2868 2868 2869 for (i = 0; i < common->port_num; i++) { 2869 2870 port = &common->ports[i]; 2870 - if (port->ndev && port->ndev->reg_state == NETREG_REGISTERED) 2871 + if (!port->ndev) 2872 + continue; 2873 + if (port->ndev->reg_state == NETREG_REGISTERED) 2871 2874 unregister_netdev(port->ndev); 2875 + free_netdev(port->ndev); 2876 + port->ndev = NULL; 2872 2877 } 2873 2878 } 2874 2879 ··· 3616 3613 3617 3614 ret = am65_cpsw_nuss_init_ndevs(common); 3618 3615 if (ret) 3619 - goto err_free_phylink; 3616 + goto err_ndevs_clear; 3620 3617 3621 3618 ret = am65_cpsw_nuss_register_ndevs(common); 3622 3619 if (ret) 3623 - goto err_free_phylink; 3620 + goto err_ndevs_clear; 3624 3621 3625 3622 pm_runtime_put(dev); 3626 3623 return 0; 3627 3624 3628 - err_free_phylink: 3625 + err_ndevs_clear: 3626 + am65_cpsw_nuss_cleanup_ndev(common); 3629 3627 am65_cpsw_nuss_phylink_cleanup(common); 3630 3628 am65_cpts_release(common->cpts); 3631 3629 err_of_clear: ··· 3656 3652 return; 3657 3653 } 3658 3654 3659 - am65_cpsw_unregister_devlink(common); 3660 3655 am65_cpsw_unregister_notifiers(common); 3661 3656 3662 3657 /* must unregister ndevs here because DD release_driver routine calls 3663 3658 * dma_deconfigure(dev) before devres_release_all(dev) 3664 3659 */ 3665 3660 am65_cpsw_nuss_cleanup_ndev(common); 3661 + am65_cpsw_unregister_devlink(common); 3666 3662 am65_cpsw_nuss_phylink_cleanup(common); 3667 3663 am65_cpts_release(common->cpts); 3668 3664 am65_cpsw_disable_serdes_phy(common);
+2
drivers/net/ethernet/ti/icssg/icssg_config.c
··· 735 735 u8 fid_c1; 736 736 737 737 tbl = prueth->vlan_tbl; 738 + spin_lock(&prueth->vtbl_lock); 738 739 fid_c1 = tbl[vid].fid_c1; 739 740 740 741 /* FID_C1: bit0..2 port membership mask, ··· 751 750 } 752 751 753 752 tbl[vid].fid_c1 = fid_c1; 753 + spin_unlock(&prueth->vtbl_lock); 754 754 } 755 755 EXPORT_SYMBOL_GPL(icssg_vtbl_modify); 756 756
+1
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 1442 1442 icss_iep_init_fw(prueth->iep1); 1443 1443 } 1444 1444 1445 + spin_lock_init(&prueth->vtbl_lock); 1445 1446 /* setup netdev interfaces */ 1446 1447 if (eth0_node) { 1447 1448 ret = prueth_netdev_init(prueth, eth0_node);
+2
drivers/net/ethernet/ti/icssg/icssg_prueth.h
··· 296 296 bool is_switchmode_supported; 297 297 unsigned char switch_id[MAX_PHYS_ITEM_ID_LEN]; 298 298 int default_vlan; 299 + /** @vtbl_lock: Lock for vtbl in shared memory */ 300 + spinlock_t vtbl_lock; 299 301 }; 300 302 301 303 struct emac_tx_ts_response {
+7 -1
drivers/net/netconsole.c
··· 1161 1161 1162 1162 this_chunk = min(userdata_len - sent_userdata, 1163 1163 MAX_PRINT_CHUNK - preceding_bytes); 1164 - if (WARN_ON_ONCE(this_chunk <= 0)) 1164 + if (WARN_ON_ONCE(this_chunk < 0)) 1165 + /* this_chunk could be zero if all the previous 1166 + * message used all the buffer. This is not a 1167 + * problem, userdata will be sent in the next 1168 + * iteration 1169 + */ 1165 1170 return; 1171 + 1166 1172 memcpy(buf + this_header + this_offset, 1167 1173 userdata + sent_userdata, 1168 1174 this_chunk);
+33 -18
drivers/net/phy/aquantia/aquantia_main.c
··· 537 537 if (!ret) 538 538 aqr107_chip_info(phydev); 539 539 540 - /* AQCS109 belongs to a chip family partially supporting 10G and 5G. 541 - * PMA speed ability bits are the same for all members of the family, 542 - * AQCS109 however supports speeds up to 2.5G only. 543 - */ 544 - phy_set_max_speed(phydev, SPEED_2500); 545 - 546 540 return aqr107_set_downshift(phydev, MDIO_AN_VEND_PROV_DOWNSHIFT_DFLT); 547 541 } 548 542 ··· 725 731 return aqr107_fill_interface_modes(phydev); 726 732 } 727 733 734 + static int aqr115c_get_features(struct phy_device *phydev) 735 + { 736 + unsigned long *supported = phydev->supported; 737 + 738 + /* PHY supports speeds up to 2.5G with autoneg. PMA capabilities 739 + * are not useful. 740 + */ 741 + linkmode_or(supported, supported, phy_gbit_features); 742 + linkmode_set_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT, supported); 743 + 744 + return 0; 745 + } 746 + 747 + static int aqr111_get_features(struct phy_device *phydev) 748 + { 749 + /* PHY supports speeds up to 5G with autoneg. PMA capabilities 750 + * are not useful. 751 + */ 752 + aqr115c_get_features(phydev); 753 + linkmode_set_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT, 754 + phydev->supported); 755 + 756 + return 0; 757 + } 758 + 728 759 static int aqr113c_config_init(struct phy_device *phydev) 729 760 { 730 761 int ret; ··· 786 767 return aqr_hwmon_probe(phydev); 787 768 } 788 769 789 - static int aqr111_config_init(struct phy_device *phydev) 790 - { 791 - /* AQR111 reports supporting speed up to 10G, 792 - * however only speeds up to 5G are supported. 793 - */ 794 - phy_set_max_speed(phydev, SPEED_5000); 795 - 796 - return aqr107_config_init(phydev); 797 - } 798 770 799 771 static struct phy_driver aqr_driver[] = { 800 772 { ··· 863 853 .get_sset_count = aqr107_get_sset_count, 864 854 .get_strings = aqr107_get_strings, 865 855 .get_stats = aqr107_get_stats, 856 + .get_features = aqr115c_get_features, 866 857 .link_change_notify = aqr107_link_change_notify, 867 858 .led_brightness_set = aqr_phy_led_brightness_set, 868 859 .led_hw_is_supported = aqr_phy_led_hw_is_supported, ··· 876 865 .name = "Aquantia AQR111", 877 866 .probe = aqr107_probe, 878 867 .get_rate_matching = aqr107_get_rate_matching, 879 - .config_init = aqr111_config_init, 868 + .config_init = aqr107_config_init, 880 869 .config_aneg = aqr_config_aneg, 881 870 .config_intr = aqr_config_intr, 882 871 .handle_interrupt = aqr_handle_interrupt, ··· 888 877 .get_sset_count = aqr107_get_sset_count, 889 878 .get_strings = aqr107_get_strings, 890 879 .get_stats = aqr107_get_stats, 880 + .get_features = aqr111_get_features, 891 881 .link_change_notify = aqr107_link_change_notify, 892 882 .led_brightness_set = aqr_phy_led_brightness_set, 893 883 .led_hw_is_supported = aqr_phy_led_hw_is_supported, ··· 901 889 .name = "Aquantia AQR111B0", 902 890 .probe = aqr107_probe, 903 891 .get_rate_matching = aqr107_get_rate_matching, 904 - .config_init = aqr111_config_init, 892 + .config_init = aqr107_config_init, 905 893 .config_aneg = aqr_config_aneg, 906 894 .config_intr = aqr_config_intr, 907 895 .handle_interrupt = aqr_handle_interrupt, ··· 913 901 .get_sset_count = aqr107_get_sset_count, 914 902 .get_strings = aqr107_get_strings, 915 903 .get_stats = aqr107_get_stats, 904 + .get_features = aqr111_get_features, 916 905 .link_change_notify = aqr107_link_change_notify, 917 906 .led_brightness_set = aqr_phy_led_brightness_set, 918 907 .led_hw_is_supported = aqr_phy_led_hw_is_supported, ··· 1023 1010 .name = "Aquantia AQR114C", 1024 1011 .probe = aqr107_probe, 1025 1012 .get_rate_matching = aqr107_get_rate_matching, 1026 - .config_init = aqr111_config_init, 1013 + .config_init = aqr107_config_init, 1027 1014 .config_aneg = aqr_config_aneg, 1028 1015 .config_intr = aqr_config_intr, 1029 1016 .handle_interrupt = aqr_handle_interrupt, ··· 1035 1022 .get_sset_count = aqr107_get_sset_count, 1036 1023 .get_strings = aqr107_get_strings, 1037 1024 .get_stats = aqr107_get_stats, 1025 + .get_features = aqr111_get_features, 1038 1026 .link_change_notify = aqr107_link_change_notify, 1039 1027 .led_brightness_set = aqr_phy_led_brightness_set, 1040 1028 .led_hw_is_supported = aqr_phy_led_hw_is_supported, ··· 1060 1046 .get_sset_count = aqr107_get_sset_count, 1061 1047 .get_strings = aqr107_get_strings, 1062 1048 .get_stats = aqr107_get_stats, 1049 + .get_features = aqr115c_get_features, 1063 1050 .link_change_notify = aqr107_link_change_notify, 1064 1051 .led_brightness_set = aqr_phy_led_brightness_set, 1065 1052 .led_hw_is_supported = aqr_phy_led_hw_is_supported,
+2 -2
drivers/net/phy/bcm84881.c
··· 132 132 133 133 bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR); 134 134 if (bmsr < 0) 135 - return val; 135 + return bmsr; 136 136 137 137 return !!(val & MDIO_AN_STAT1_COMPLETE) && 138 138 !!(bmsr & BMSR_ANEGCOMPLETE); ··· 158 158 159 159 bmsr = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_C22 + MII_BMSR); 160 160 if (bmsr < 0) 161 - return val; 161 + return bmsr; 162 162 163 163 phydev->autoneg_complete = !!(val & MDIO_AN_STAT1_COMPLETE) && 164 164 !!(bmsr & BMSR_ANEGCOMPLETE);
-1
drivers/net/phy/dp83869.c
··· 645 645 phydev->supported); 646 646 647 647 linkmode_set_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, phydev->supported); 648 - linkmode_set_bit(ADVERTISED_FIBRE, phydev->advertising); 649 648 650 649 if (dp83869->mode == DP83869_RGMII_1000_BASE) { 651 650 linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
+3 -2
drivers/net/phy/phy_device.c
··· 3326 3326 3327 3327 static void phy_leds_unregister(struct phy_device *phydev) 3328 3328 { 3329 - struct phy_led *phyled; 3329 + struct phy_led *phyled, *tmp; 3330 3330 3331 - list_for_each_entry(phyled, &phydev->leds, list) { 3331 + list_for_each_entry_safe(phyled, tmp, &phydev->leds, list) { 3332 3332 led_classdev_unregister(&phyled->led_cdev); 3333 + list_del(&phyled->list); 3333 3334 } 3334 3335 } 3335 3336
+23 -1
drivers/net/phy/realtek.c
··· 1081 1081 return rtlgen_is_c45_match(phydev, RTL_8221B_VN_CG, true); 1082 1082 } 1083 1083 1084 + static int rtl8251b_c22_match_phy_device(struct phy_device *phydev) 1085 + { 1086 + return rtlgen_is_c45_match(phydev, RTL_8251B, false); 1087 + } 1088 + 1089 + static int rtl8251b_c45_match_phy_device(struct phy_device *phydev) 1090 + { 1091 + return rtlgen_is_c45_match(phydev, RTL_8251B, true); 1092 + } 1093 + 1084 1094 static int rtlgen_resume(struct phy_device *phydev) 1085 1095 { 1086 1096 int ret = genphy_resume(phydev); ··· 1428 1418 .suspend = genphy_c45_pma_suspend, 1429 1419 .resume = rtlgen_c45_resume, 1430 1420 }, { 1431 - PHY_ID_MATCH_EXACT(0x001cc862), 1421 + .match_phy_device = rtl8251b_c45_match_phy_device, 1432 1422 .name = "RTL8251B 5Gbps PHY", 1433 1423 .get_features = rtl822x_get_features, 1434 1424 .config_aneg = rtl822x_config_aneg, ··· 1437 1427 .resume = rtlgen_resume, 1438 1428 .read_page = rtl821x_read_page, 1439 1429 .write_page = rtl821x_write_page, 1430 + }, { 1431 + .match_phy_device = rtl8251b_c22_match_phy_device, 1432 + .name = "RTL8126A-internal 5Gbps PHY", 1433 + .get_features = rtl822x_get_features, 1434 + .config_aneg = rtl822x_config_aneg, 1435 + .read_status = rtl822x_read_status, 1436 + .suspend = genphy_suspend, 1437 + .resume = rtlgen_resume, 1438 + .read_page = rtl821x_read_page, 1439 + .write_page = rtl821x_write_page, 1440 + .read_mmd = rtl822x_read_mmd, 1441 + .write_mmd = rtl822x_write_mmd, 1440 1442 }, { 1441 1443 PHY_ID_MATCH_EXACT(0x001ccad0), 1442 1444 .name = "RTL8224 2.5Gbps PHY",
+1 -1
drivers/net/ppp/ppp_async.c
··· 542 542 * and 7 (code-reject) must be sent as though no options 543 543 * had been negotiated. 544 544 */ 545 - islcp = proto == PPP_LCP && 1 <= data[2] && data[2] <= 7; 545 + islcp = proto == PPP_LCP && count >= 3 && 1 <= data[2] && data[2] <= 7; 546 546 547 547 if (i == 0) { 548 548 if (islcp)
+11
drivers/net/pse-pd/pse_core.c
··· 785 785 */ 786 786 switch (config->c33_admin_control) { 787 787 case ETHTOOL_C33_PSE_ADMIN_STATE_ENABLED: 788 + /* We could have mismatch between admin_state_enabled and 789 + * state reported by regulator_is_enabled. This can occur when 790 + * the PI is forcibly turn off by the controller. Call 791 + * regulator_disable on that case to fix the counters state. 792 + */ 793 + if (psec->pcdev->pi[psec->id].admin_state_enabled && 794 + !regulator_is_enabled(psec->ps)) { 795 + err = regulator_disable(psec->ps); 796 + if (err) 797 + break; 798 + } 788 799 if (!psec->pcdev->pi[psec->id].admin_state_enabled) 789 800 err = regulator_enable(psec->ps); 790 801 break;
+34 -23
drivers/net/slip/slhc.c
··· 643 643 int 644 644 slhc_remember(struct slcompress *comp, unsigned char *icp, int isize) 645 645 { 646 - struct cstate *cs; 647 - unsigned ihl; 648 - 646 + const struct tcphdr *th; 649 647 unsigned char index; 648 + struct iphdr *iph; 649 + struct cstate *cs; 650 + unsigned int ihl; 650 651 651 - if(isize < 20) { 652 - /* The packet is shorter than a legal IP header */ 652 + /* The packet is shorter than a legal IP header. 653 + * Also make sure isize is positive. 654 + */ 655 + if (isize < (int)sizeof(struct iphdr)) { 656 + runt: 653 657 comp->sls_i_runt++; 654 - return slhc_toss( comp ); 658 + return slhc_toss(comp); 655 659 } 660 + iph = (struct iphdr *)icp; 656 661 /* Peek at the IP header's IHL field to find its length */ 657 - ihl = icp[0] & 0xf; 658 - if(ihl < 20 / 4){ 659 - /* The IP header length field is too small */ 660 - comp->sls_i_runt++; 661 - return slhc_toss( comp ); 662 - } 663 - index = icp[9]; 664 - icp[9] = IPPROTO_TCP; 662 + ihl = iph->ihl; 663 + /* The IP header length field is too small, 664 + * or packet is shorter than the IP header followed 665 + * by minimal tcp header. 666 + */ 667 + if (ihl < 5 || isize < ihl * 4 + sizeof(struct tcphdr)) 668 + goto runt; 669 + 670 + index = iph->protocol; 671 + iph->protocol = IPPROTO_TCP; 665 672 666 673 if (ip_fast_csum(icp, ihl)) { 667 674 /* Bad IP header checksum; discard */ 668 675 comp->sls_i_badcheck++; 669 - return slhc_toss( comp ); 676 + return slhc_toss(comp); 670 677 } 671 - if(index > comp->rslot_limit) { 678 + if (index > comp->rslot_limit) { 672 679 comp->sls_i_error++; 673 680 return slhc_toss(comp); 674 681 } 675 - 682 + th = (struct tcphdr *)(icp + ihl * 4); 683 + if (th->doff < sizeof(struct tcphdr) / 4) 684 + goto runt; 685 + if (isize < ihl * 4 + th->doff * 4) 686 + goto runt; 676 687 /* Update local state */ 677 688 cs = &comp->rstate[comp->recv_current = index]; 678 689 comp->flags &=~ SLF_TOSS; 679 - memcpy(&cs->cs_ip,icp,20); 680 - memcpy(&cs->cs_tcp,icp + ihl*4,20); 690 + memcpy(&cs->cs_ip, iph, sizeof(*iph)); 691 + memcpy(&cs->cs_tcp, th, sizeof(*th)); 681 692 if (ihl > 5) 682 - memcpy(cs->cs_ipopt, icp + sizeof(struct iphdr), (ihl - 5) * 4); 683 - if (cs->cs_tcp.doff > 5) 684 - memcpy(cs->cs_tcpopt, icp + ihl*4 + sizeof(struct tcphdr), (cs->cs_tcp.doff - 5) * 4); 685 - cs->cs_hsize = ihl*2 + cs->cs_tcp.doff*2; 693 + memcpy(cs->cs_ipopt, &iph[1], (ihl - 5) * 4); 694 + if (th->doff > 5) 695 + memcpy(cs->cs_tcpopt, &th[1], (th->doff - 5) * 4); 696 + cs->cs_hsize = ihl*2 + th->doff*2; 686 697 cs->initialized = true; 687 698 /* Put headers back on packet 688 699 * Neither header checksum is recalculated
+5 -1
drivers/net/vxlan/vxlan_core.c
··· 4913 4913 if (rc) 4914 4914 goto out4; 4915 4915 4916 - vxlan_vnifilter_init(); 4916 + rc = vxlan_vnifilter_init(); 4917 + if (rc) 4918 + goto out5; 4917 4919 4918 4920 return 0; 4921 + out5: 4922 + rtnl_link_unregister(&vxlan_link_ops); 4919 4923 out4: 4920 4924 unregister_switchdev_notifier(&vxlan_switchdev_notifier_block); 4921 4925 out3:
+1 -1
drivers/net/vxlan/vxlan_private.h
··· 202 202 int vxlan_vnigroup_init(struct vxlan_dev *vxlan); 203 203 void vxlan_vnigroup_uninit(struct vxlan_dev *vxlan); 204 204 205 - void vxlan_vnifilter_init(void); 205 + int vxlan_vnifilter_init(void); 206 206 void vxlan_vnifilter_uninit(void); 207 207 void vxlan_vnifilter_count(struct vxlan_dev *vxlan, __be32 vni, 208 208 struct vxlan_vni_node *vninode,
+9 -10
drivers/net/vxlan/vxlan_vnifilter.c
··· 992 992 return err; 993 993 } 994 994 995 - void vxlan_vnifilter_init(void) 995 + static const struct rtnl_msg_handler vxlan_vnifilter_rtnl_msg_handlers[] = { 996 + {THIS_MODULE, PF_BRIDGE, RTM_GETTUNNEL, NULL, vxlan_vnifilter_dump, 0}, 997 + {THIS_MODULE, PF_BRIDGE, RTM_NEWTUNNEL, vxlan_vnifilter_process, NULL, 0}, 998 + {THIS_MODULE, PF_BRIDGE, RTM_DELTUNNEL, vxlan_vnifilter_process, NULL, 0}, 999 + }; 1000 + 1001 + int vxlan_vnifilter_init(void) 996 1002 { 997 - rtnl_register_module(THIS_MODULE, PF_BRIDGE, RTM_GETTUNNEL, NULL, 998 - vxlan_vnifilter_dump, 0); 999 - rtnl_register_module(THIS_MODULE, PF_BRIDGE, RTM_NEWTUNNEL, 1000 - vxlan_vnifilter_process, NULL, 0); 1001 - rtnl_register_module(THIS_MODULE, PF_BRIDGE, RTM_DELTUNNEL, 1002 - vxlan_vnifilter_process, NULL, 0); 1003 + return rtnl_register_many(vxlan_vnifilter_rtnl_msg_handlers); 1003 1004 } 1004 1005 1005 1006 void vxlan_vnifilter_uninit(void) 1006 1007 { 1007 - rtnl_unregister(PF_BRIDGE, RTM_GETTUNNEL); 1008 - rtnl_unregister(PF_BRIDGE, RTM_NEWTUNNEL); 1009 - rtnl_unregister(PF_BRIDGE, RTM_DELTUNNEL); 1008 + rtnl_unregister_many(vxlan_vnifilter_rtnl_msg_handlers); 1010 1009 }
+1 -1
include/net/mctp.h
··· 295 295 int mctp_routes_init(void); 296 296 void mctp_routes_exit(void); 297 297 298 - void mctp_device_init(void); 298 + int mctp_device_init(void); 299 299 void mctp_device_exit(void); 300 300 301 301 #endif /* __NET_MCTP_H */
+17
include/net/rtnetlink.h
··· 29 29 return msgtype & RTNL_KIND_MASK; 30 30 } 31 31 32 + struct rtnl_msg_handler { 33 + struct module *owner; 34 + int protocol; 35 + int msgtype; 36 + rtnl_doit_func doit; 37 + rtnl_dumpit_func dumpit; 38 + int flags; 39 + }; 40 + 32 41 void rtnl_register(int protocol, int msgtype, 33 42 rtnl_doit_func, rtnl_dumpit_func, unsigned int flags); 34 43 int rtnl_register_module(struct module *owner, int protocol, int msgtype, 35 44 rtnl_doit_func, rtnl_dumpit_func, unsigned int flags); 36 45 int rtnl_unregister(int protocol, int msgtype); 37 46 void rtnl_unregister_all(int protocol); 47 + 48 + int __rtnl_register_many(const struct rtnl_msg_handler *handlers, int n); 49 + void __rtnl_unregister_many(const struct rtnl_msg_handler *handlers, int n); 50 + 51 + #define rtnl_register_many(handlers) \ 52 + __rtnl_register_many(handlers, ARRAY_SIZE(handlers)) 53 + #define rtnl_unregister_many(handlers) \ 54 + __rtnl_unregister_many(handlers, ARRAY_SIZE(handlers)) 38 55 39 56 static inline int rtnl_msg_family(const struct nlmsghdr *nlh) 40 57 {
-1
include/net/sch_generic.h
··· 848 848 static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch, 849 849 struct sk_buff **to_free) 850 850 { 851 - qdisc_calculate_pkt_len(skb, sch); 852 851 return sch->enqueue(skb, sch, to_free); 853 852 } 854 853
+2
include/net/sock.h
··· 894 894 hlist_for_each_entry_safe(__sk, tmp, list, sk_node) 895 895 #define sk_for_each_bound(__sk, list) \ 896 896 hlist_for_each_entry(__sk, list, sk_bind_node) 897 + #define sk_for_each_bound_safe(__sk, tmp, list) \ 898 + hlist_for_each_entry_safe(__sk, tmp, list, sk_bind_node) 897 899 898 900 /** 899 901 * sk_for_each_entry_offset_rcu - iterate over a list at a given struct offset
+3
net/bluetooth/hci_conn.c
··· 289 289 290 290 kfree(conn_handle); 291 291 292 + if (!hci_conn_valid(hdev, conn)) 293 + return -ECANCELED; 294 + 292 295 bt_dev_dbg(hdev, "hcon %p", conn); 293 296 294 297 configure_datapath_sync(hdev, &conn->codec);
-2
net/bluetooth/rfcomm/sock.c
··· 865 865 866 866 if (err == -ENOIOCTLCMD) { 867 867 #ifdef CONFIG_BT_RFCOMM_TTY 868 - lock_sock(sk); 869 868 err = rfcomm_dev_ioctl(sk, cmd, (void __user *) arg); 870 - release_sock(sk); 871 869 #else 872 870 err = -EOPNOTSUPP; 873 871 #endif
+5
net/bridge/br_netfilter_hooks.c
··· 33 33 #include <net/ip.h> 34 34 #include <net/ipv6.h> 35 35 #include <net/addrconf.h> 36 + #include <net/dst_metadata.h> 36 37 #include <net/route.h> 37 38 #include <net/netfilter/br_netfilter.h> 38 39 #include <net/netns/generic.h> ··· 879 878 nf_bridge_info_free(skb); 880 879 return br_dev_queue_push_xmit(net, sk, skb); 881 880 } 881 + 882 + /* Fragmentation on metadata/template dst is not supported */ 883 + if (unlikely(!skb_valid_dst(skb))) 884 + goto drop; 882 885 883 886 /* This is wrong! We should preserve the original fragment 884 887 * boundaries by preserving frag_list rather than refragmenting.
+5 -1
net/bridge/br_netlink.c
··· 1920 1920 { 1921 1921 int err; 1922 1922 1923 - br_vlan_rtnl_init(); 1923 + err = br_vlan_rtnl_init(); 1924 + if (err) 1925 + goto out; 1926 + 1924 1927 rtnl_af_register(&br_af_ops); 1925 1928 1926 1929 err = rtnl_link_register(&br_link_ops); ··· 1934 1931 1935 1932 out_af: 1936 1933 rtnl_af_unregister(&br_af_ops); 1934 + out: 1937 1935 return err; 1938 1936 } 1939 1937
+3 -2
net/bridge/br_private.h
··· 1571 1571 void br_vlan_port_event(struct net_bridge_port *p, unsigned long event); 1572 1572 int br_vlan_bridge_event(struct net_device *dev, unsigned long event, 1573 1573 void *ptr); 1574 - void br_vlan_rtnl_init(void); 1574 + int br_vlan_rtnl_init(void); 1575 1575 void br_vlan_rtnl_uninit(void); 1576 1576 void br_vlan_notify(const struct net_bridge *br, 1577 1577 const struct net_bridge_port *p, ··· 1802 1802 return 0; 1803 1803 } 1804 1804 1805 - static inline void br_vlan_rtnl_init(void) 1805 + static inline int br_vlan_rtnl_init(void) 1806 1806 { 1807 + return 0; 1807 1808 } 1808 1809 1809 1810 static inline void br_vlan_rtnl_uninit(void)
+9 -10
net/bridge/br_vlan.c
··· 2296 2296 return err; 2297 2297 } 2298 2298 2299 - void br_vlan_rtnl_init(void) 2299 + static const struct rtnl_msg_handler br_vlan_rtnl_msg_handlers[] = { 2300 + {THIS_MODULE, PF_BRIDGE, RTM_NEWVLAN, br_vlan_rtm_process, NULL, 0}, 2301 + {THIS_MODULE, PF_BRIDGE, RTM_DELVLAN, br_vlan_rtm_process, NULL, 0}, 2302 + {THIS_MODULE, PF_BRIDGE, RTM_GETVLAN, NULL, br_vlan_rtm_dump, 0}, 2303 + }; 2304 + 2305 + int br_vlan_rtnl_init(void) 2300 2306 { 2301 - rtnl_register_module(THIS_MODULE, PF_BRIDGE, RTM_GETVLAN, NULL, 2302 - br_vlan_rtm_dump, 0); 2303 - rtnl_register_module(THIS_MODULE, PF_BRIDGE, RTM_NEWVLAN, 2304 - br_vlan_rtm_process, NULL, 0); 2305 - rtnl_register_module(THIS_MODULE, PF_BRIDGE, RTM_DELVLAN, 2306 - br_vlan_rtm_process, NULL, 0); 2307 + return rtnl_register_many(br_vlan_rtnl_msg_handlers); 2307 2308 } 2308 2309 2309 2310 void br_vlan_rtnl_uninit(void) 2310 2311 { 2311 - rtnl_unregister(PF_BRIDGE, RTM_GETVLAN); 2312 - rtnl_unregister(PF_BRIDGE, RTM_NEWVLAN); 2313 - rtnl_unregister(PF_BRIDGE, RTM_DELVLAN); 2312 + rtnl_unregister_many(br_vlan_rtnl_msg_handlers); 2314 2313 }
+12 -5
net/core/dst.c
··· 109 109 child = xdst->child; 110 110 } 111 111 #endif 112 - if (!(dst->flags & DST_NOCOUNT)) 113 - dst_entries_add(dst->ops, -1); 114 - 115 112 if (dst->ops->destroy) 116 113 dst->ops->destroy(dst); 117 114 netdev_put(dst->dev, &dst->dev_tracker); ··· 156 159 } 157 160 EXPORT_SYMBOL(dst_dev_put); 158 161 162 + static void dst_count_dec(struct dst_entry *dst) 163 + { 164 + if (!(dst->flags & DST_NOCOUNT)) 165 + dst_entries_add(dst->ops, -1); 166 + } 167 + 159 168 void dst_release(struct dst_entry *dst) 160 169 { 161 - if (dst && rcuref_put(&dst->__rcuref)) 170 + if (dst && rcuref_put(&dst->__rcuref)) { 171 + dst_count_dec(dst); 162 172 call_rcu_hurry(&dst->rcu_head, dst_destroy_rcu); 173 + } 163 174 } 164 175 EXPORT_SYMBOL(dst_release); 165 176 166 177 void dst_release_immediate(struct dst_entry *dst) 167 178 { 168 - if (dst && rcuref_put(&dst->__rcuref)) 179 + if (dst && rcuref_put(&dst->__rcuref)) { 180 + dst_count_dec(dst); 169 181 dst_destroy(dst); 182 + } 170 183 } 171 184 EXPORT_SYMBOL(dst_release_immediate); 172 185
+29
net/core/rtnetlink.c
··· 384 384 } 385 385 EXPORT_SYMBOL_GPL(rtnl_unregister_all); 386 386 387 + int __rtnl_register_many(const struct rtnl_msg_handler *handlers, int n) 388 + { 389 + const struct rtnl_msg_handler *handler; 390 + int i, err; 391 + 392 + for (i = 0, handler = handlers; i < n; i++, handler++) { 393 + err = rtnl_register_internal(handler->owner, handler->protocol, 394 + handler->msgtype, handler->doit, 395 + handler->dumpit, handler->flags); 396 + if (err) { 397 + __rtnl_unregister_many(handlers, i); 398 + break; 399 + } 400 + } 401 + 402 + return err; 403 + } 404 + EXPORT_SYMBOL_GPL(__rtnl_register_many); 405 + 406 + void __rtnl_unregister_many(const struct rtnl_msg_handler *handlers, int n) 407 + { 408 + const struct rtnl_msg_handler *handler; 409 + int i; 410 + 411 + for (i = n - 1, handler = handlers + n - 1; i >= 0; i--, handler--) 412 + rtnl_unregister(handler->protocol, handler->msgtype); 413 + } 414 + EXPORT_SYMBOL_GPL(__rtnl_unregister_many); 415 + 387 416 static LIST_HEAD(link_ops); 388 417 389 418 static const struct rtnl_link_ops *rtnl_link_ops_get(const char *kind)
+8 -3
net/dsa/user.c
··· 1392 1392 if (!dsa_user_dev_check(act->dev)) 1393 1393 return -EOPNOTSUPP; 1394 1394 1395 + to_dp = dsa_user_to_port(act->dev); 1396 + 1397 + if (dp->ds != to_dp->ds) { 1398 + NL_SET_ERR_MSG_MOD(extack, 1399 + "Cross-chip mirroring not implemented"); 1400 + return -EOPNOTSUPP; 1401 + } 1402 + 1395 1403 mall_tc_entry = kzalloc(sizeof(*mall_tc_entry), GFP_KERNEL); 1396 1404 if (!mall_tc_entry) 1397 1405 return -ENOMEM; ··· 1407 1399 mall_tc_entry->cookie = cls->cookie; 1408 1400 mall_tc_entry->type = DSA_PORT_MALL_MIRROR; 1409 1401 mirror = &mall_tc_entry->mirror; 1410 - 1411 - to_dp = dsa_user_to_port(act->dev); 1412 - 1413 1402 mirror->to_local_port = to_dp->index; 1414 1403 mirror->ingress = ingress; 1415 1404
+1 -3
net/ipv4/netfilter/nft_fib_ipv4.c
··· 65 65 .flowi4_scope = RT_SCOPE_UNIVERSE, 66 66 .flowi4_iif = LOOPBACK_IFINDEX, 67 67 .flowi4_uid = sock_net_uid(nft_net(pkt), NULL), 68 + .flowi4_l3mdev = l3mdev_master_ifindex_rcu(nft_in(pkt)), 68 69 }; 69 70 const struct net_device *oif; 70 71 const struct net_device *found; ··· 83 82 oif = nft_in(pkt); 84 83 else 85 84 oif = NULL; 86 - 87 - if (priv->flags & NFTA_FIB_F_IIF) 88 - fl4.flowi4_l3mdev = l3mdev_master_ifindex_rcu(oif); 89 85 90 86 if (nft_hook(pkt) == NF_INET_PRE_ROUTING && 91 87 nft_fib_is_loopback(pkt->skb, nft_in(pkt))) {
+38 -4
net/ipv4/tcp_input.c
··· 2473 2473 */ 2474 2474 static inline bool tcp_packet_delayed(const struct tcp_sock *tp) 2475 2475 { 2476 - return tp->retrans_stamp && 2477 - tcp_tsopt_ecr_before(tp, tp->retrans_stamp); 2476 + const struct sock *sk = (const struct sock *)tp; 2477 + 2478 + if (tp->retrans_stamp && 2479 + tcp_tsopt_ecr_before(tp, tp->retrans_stamp)) 2480 + return true; /* got echoed TS before first retransmission */ 2481 + 2482 + /* Check if nothing was retransmitted (retrans_stamp==0), which may 2483 + * happen in fast recovery due to TSQ. But we ignore zero retrans_stamp 2484 + * in TCP_SYN_SENT, since when we set FLAG_SYN_ACKED we also clear 2485 + * retrans_stamp even if we had retransmitted the SYN. 2486 + */ 2487 + if (!tp->retrans_stamp && /* no record of a retransmit/SYN? */ 2488 + sk->sk_state != TCP_SYN_SENT) /* not the FLAG_SYN_ACKED case? */ 2489 + return true; /* nothing was retransmitted */ 2490 + 2491 + return false; 2478 2492 } 2479 2493 2480 2494 /* Undo procedures. */ ··· 2520 2506 return true; 2521 2507 2522 2508 return false; 2509 + } 2510 + 2511 + /* If loss recovery is finished and there are no retransmits out in the 2512 + * network, then we clear retrans_stamp so that upon the next loss recovery 2513 + * retransmits_timed_out() and timestamp-undo are using the correct value. 2514 + */ 2515 + static void tcp_retrans_stamp_cleanup(struct sock *sk) 2516 + { 2517 + if (!tcp_any_retrans_done(sk)) 2518 + tcp_sk(sk)->retrans_stamp = 0; 2523 2519 } 2524 2520 2525 2521 static void DBGUNDO(struct sock *sk, const char *msg) ··· 2898 2874 { 2899 2875 struct tcp_sock *tp = tcp_sk(sk); 2900 2876 int mib_idx; 2877 + 2878 + /* Start the clock with our fast retransmit, for undo and ETIMEDOUT. */ 2879 + tcp_retrans_stamp_cleanup(sk); 2901 2880 2902 2881 if (tcp_is_reno(tp)) 2903 2882 mib_idx = LINUX_MIB_TCPRENORECOVERY; ··· 6684 6657 if (inet_csk(sk)->icsk_ca_state == TCP_CA_Loss && !tp->packets_out) 6685 6658 tcp_try_undo_recovery(sk); 6686 6659 6687 - /* Reset rtx states to prevent spurious retransmits_timed_out() */ 6688 6660 tcp_update_rto_time(tp); 6689 - tp->retrans_stamp = 0; 6690 6661 inet_csk(sk)->icsk_retransmits = 0; 6662 + /* In tcp_fastopen_synack_timer() on the first SYNACK RTO we set 6663 + * retrans_stamp but don't enter CA_Loss, so in case that happened we 6664 + * need to zero retrans_stamp here to prevent spurious 6665 + * retransmits_timed_out(). However, if the ACK of our SYNACK caused us 6666 + * to enter CA_Recovery then we need to leave retrans_stamp as it was 6667 + * set entering CA_Recovery, for correct retransmits_timed_out() and 6668 + * undo behavior. 6669 + */ 6670 + tcp_retrans_stamp_cleanup(sk); 6691 6671 6692 6672 /* Once we leave TCP_SYN_RECV or TCP_FIN_WAIT_1, 6693 6673 * we no longer need req so release it.
+1 -4
net/ipv4/tcp_output.c
··· 2342 2342 if (len <= skb->len) 2343 2343 break; 2344 2344 2345 - if (unlikely(TCP_SKB_CB(skb)->eor) || 2346 - tcp_has_tx_tstamp(skb) || 2347 - !skb_pure_zcopy_same(skb, next) || 2348 - skb_frags_readable(skb) != skb_frags_readable(next)) 2345 + if (tcp_has_tx_tstamp(skb) || !tcp_skb_can_collapse(skb, next)) 2349 2346 return false; 2350 2347 2351 2348 len -= skb->len;
+3 -2
net/ipv6/netfilter/nft_fib_ipv6.c
··· 41 41 if (ipv6_addr_type(&fl6->daddr) & IPV6_ADDR_LINKLOCAL) { 42 42 lookup_flags |= RT6_LOOKUP_F_IFACE; 43 43 fl6->flowi6_oif = get_ifindex(dev ? dev : pkt->skb->dev); 44 - } else if (priv->flags & NFTA_FIB_F_IIF) { 45 - fl6->flowi6_l3mdev = l3mdev_master_ifindex_rcu(dev); 46 44 } 47 45 48 46 if (ipv6_addr_type(&fl6->saddr) & IPV6_ADDR_UNICAST) ··· 72 74 dev = nft_in(pkt); 73 75 else if (priv->flags & NFTA_FIB_F_OIF) 74 76 dev = nft_out(pkt); 77 + 78 + fl6.flowi6_l3mdev = l3mdev_master_ifindex_rcu(dev); 75 79 76 80 nft_fib6_flowi_init(&fl6, priv, pkt, dev, iph); 77 81 ··· 165 165 .flowi6_iif = LOOPBACK_IFINDEX, 166 166 .flowi6_proto = pkt->tprot, 167 167 .flowi6_uid = sock_net_uid(nft_net(pkt), NULL), 168 + .flowi6_l3mdev = l3mdev_master_ifindex_rcu(nft_in(pkt)), 168 169 }; 169 170 struct rt6_info *rt; 170 171 int lookup_flags;
+5 -1
net/mctp/af_mctp.c
··· 756 756 if (rc) 757 757 goto err_unreg_routes; 758 758 759 - mctp_device_init(); 759 + rc = mctp_device_init(); 760 + if (rc) 761 + goto err_unreg_neigh; 760 762 761 763 return 0; 762 764 765 + err_unreg_neigh: 766 + mctp_neigh_exit(); 763 767 err_unreg_routes: 764 768 mctp_routes_exit(); 765 769 err_unreg_proto:
+19 -13
net/mctp/device.c
··· 524 524 .priority = ADDRCONF_NOTIFY_PRIORITY, 525 525 }; 526 526 527 - void __init mctp_device_init(void) 528 - { 529 - register_netdevice_notifier(&mctp_dev_nb); 527 + static const struct rtnl_msg_handler mctp_device_rtnl_msg_handlers[] = { 528 + {THIS_MODULE, PF_MCTP, RTM_NEWADDR, mctp_rtm_newaddr, NULL, 0}, 529 + {THIS_MODULE, PF_MCTP, RTM_DELADDR, mctp_rtm_deladdr, NULL, 0}, 530 + {THIS_MODULE, PF_MCTP, RTM_GETADDR, NULL, mctp_dump_addrinfo, 0}, 531 + }; 530 532 531 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_GETADDR, 532 - NULL, mctp_dump_addrinfo, 0); 533 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_NEWADDR, 534 - mctp_rtm_newaddr, NULL, 0); 535 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_DELADDR, 536 - mctp_rtm_deladdr, NULL, 0); 533 + int __init mctp_device_init(void) 534 + { 535 + int err; 536 + 537 + register_netdevice_notifier(&mctp_dev_nb); 537 538 rtnl_af_register(&mctp_af_ops); 539 + 540 + err = rtnl_register_many(mctp_device_rtnl_msg_handlers); 541 + if (err) { 542 + rtnl_af_unregister(&mctp_af_ops); 543 + unregister_netdevice_notifier(&mctp_dev_nb); 544 + } 545 + 546 + return err; 538 547 } 539 548 540 549 void __exit mctp_device_exit(void) 541 550 { 551 + rtnl_unregister_many(mctp_device_rtnl_msg_handlers); 542 552 rtnl_af_unregister(&mctp_af_ops); 543 - rtnl_unregister(PF_MCTP, RTM_DELADDR); 544 - rtnl_unregister(PF_MCTP, RTM_NEWADDR); 545 - rtnl_unregister(PF_MCTP, RTM_GETADDR); 546 - 547 553 unregister_netdevice_notifier(&mctp_dev_nb); 548 554 }
+18 -11
net/mctp/neigh.c
··· 322 322 .exit = mctp_neigh_net_exit, 323 323 }; 324 324 325 + static const struct rtnl_msg_handler mctp_neigh_rtnl_msg_handlers[] = { 326 + {THIS_MODULE, PF_MCTP, RTM_NEWNEIGH, mctp_rtm_newneigh, NULL, 0}, 327 + {THIS_MODULE, PF_MCTP, RTM_DELNEIGH, mctp_rtm_delneigh, NULL, 0}, 328 + {THIS_MODULE, PF_MCTP, RTM_GETNEIGH, NULL, mctp_rtm_getneigh, 0}, 329 + }; 330 + 325 331 int __init mctp_neigh_init(void) 326 332 { 327 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_NEWNEIGH, 328 - mctp_rtm_newneigh, NULL, 0); 329 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_DELNEIGH, 330 - mctp_rtm_delneigh, NULL, 0); 331 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_GETNEIGH, 332 - NULL, mctp_rtm_getneigh, 0); 333 + int err; 333 334 334 - return register_pernet_subsys(&mctp_net_ops); 335 + err = register_pernet_subsys(&mctp_net_ops); 336 + if (err) 337 + return err; 338 + 339 + err = rtnl_register_many(mctp_neigh_rtnl_msg_handlers); 340 + if (err) 341 + unregister_pernet_subsys(&mctp_net_ops); 342 + 343 + return err; 335 344 } 336 345 337 - void __exit mctp_neigh_exit(void) 346 + void mctp_neigh_exit(void) 338 347 { 348 + rtnl_unregister_many(mctp_neigh_rtnl_msg_handlers); 339 349 unregister_pernet_subsys(&mctp_net_ops); 340 - rtnl_unregister(PF_MCTP, RTM_GETNEIGH); 341 - rtnl_unregister(PF_MCTP, RTM_DELNEIGH); 342 - rtnl_unregister(PF_MCTP, RTM_NEWNEIGH); 343 350 }
+23 -10
net/mctp/route.c
··· 1474 1474 .exit = mctp_routes_net_exit, 1475 1475 }; 1476 1476 1477 + static const struct rtnl_msg_handler mctp_route_rtnl_msg_handlers[] = { 1478 + {THIS_MODULE, PF_MCTP, RTM_NEWROUTE, mctp_newroute, NULL, 0}, 1479 + {THIS_MODULE, PF_MCTP, RTM_DELROUTE, mctp_delroute, NULL, 0}, 1480 + {THIS_MODULE, PF_MCTP, RTM_GETROUTE, NULL, mctp_dump_rtinfo, 0}, 1481 + }; 1482 + 1477 1483 int __init mctp_routes_init(void) 1478 1484 { 1485 + int err; 1486 + 1479 1487 dev_add_pack(&mctp_packet_type); 1480 1488 1481 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_GETROUTE, 1482 - NULL, mctp_dump_rtinfo, 0); 1483 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_NEWROUTE, 1484 - mctp_newroute, NULL, 0); 1485 - rtnl_register_module(THIS_MODULE, PF_MCTP, RTM_DELROUTE, 1486 - mctp_delroute, NULL, 0); 1489 + err = register_pernet_subsys(&mctp_net_ops); 1490 + if (err) 1491 + goto err_pernet; 1487 1492 1488 - return register_pernet_subsys(&mctp_net_ops); 1493 + err = rtnl_register_many(mctp_route_rtnl_msg_handlers); 1494 + if (err) 1495 + goto err_rtnl; 1496 + 1497 + return 0; 1498 + 1499 + err_rtnl: 1500 + unregister_pernet_subsys(&mctp_net_ops); 1501 + err_pernet: 1502 + dev_remove_pack(&mctp_packet_type); 1503 + return err; 1489 1504 } 1490 1505 1491 1506 void mctp_routes_exit(void) 1492 1507 { 1508 + rtnl_unregister_many(mctp_route_rtnl_msg_handlers); 1493 1509 unregister_pernet_subsys(&mctp_net_ops); 1494 - rtnl_unregister(PF_MCTP, RTM_DELROUTE); 1495 - rtnl_unregister(PF_MCTP, RTM_NEWROUTE); 1496 - rtnl_unregister(PF_MCTP, RTM_GETROUTE); 1497 1510 dev_remove_pack(&mctp_packet_type); 1498 1511 } 1499 1512
+21 -11
net/mpls/af_mpls.c
··· 2728 2728 .get_stats_af_size = mpls_get_stats_af_size, 2729 2729 }; 2730 2730 2731 + static const struct rtnl_msg_handler mpls_rtnl_msg_handlers[] __initdata_or_module = { 2732 + {THIS_MODULE, PF_MPLS, RTM_NEWROUTE, mpls_rtm_newroute, NULL, 0}, 2733 + {THIS_MODULE, PF_MPLS, RTM_DELROUTE, mpls_rtm_delroute, NULL, 0}, 2734 + {THIS_MODULE, PF_MPLS, RTM_GETROUTE, mpls_getroute, mpls_dump_routes, 0}, 2735 + {THIS_MODULE, PF_MPLS, RTM_GETNETCONF, 2736 + mpls_netconf_get_devconf, mpls_netconf_dump_devconf, 2737 + RTNL_FLAG_DUMP_UNLOCKED}, 2738 + }; 2739 + 2731 2740 static int __init mpls_init(void) 2732 2741 { 2733 2742 int err; ··· 2755 2746 2756 2747 rtnl_af_register(&mpls_af_ops); 2757 2748 2758 - rtnl_register_module(THIS_MODULE, PF_MPLS, RTM_NEWROUTE, 2759 - mpls_rtm_newroute, NULL, 0); 2760 - rtnl_register_module(THIS_MODULE, PF_MPLS, RTM_DELROUTE, 2761 - mpls_rtm_delroute, NULL, 0); 2762 - rtnl_register_module(THIS_MODULE, PF_MPLS, RTM_GETROUTE, 2763 - mpls_getroute, mpls_dump_routes, 0); 2764 - rtnl_register_module(THIS_MODULE, PF_MPLS, RTM_GETNETCONF, 2765 - mpls_netconf_get_devconf, 2766 - mpls_netconf_dump_devconf, 2767 - RTNL_FLAG_DUMP_UNLOCKED); 2768 - err = ipgre_tunnel_encap_add_mpls_ops(); 2749 + err = rtnl_register_many(mpls_rtnl_msg_handlers); 2769 2750 if (err) 2751 + goto out_unregister_rtnl_af; 2752 + 2753 + err = ipgre_tunnel_encap_add_mpls_ops(); 2754 + if (err) { 2770 2755 pr_err("Can't add mpls over gre tunnel ops\n"); 2756 + goto out_unregister_rtnl; 2757 + } 2771 2758 2772 2759 err = 0; 2773 2760 out: 2774 2761 return err; 2775 2762 2763 + out_unregister_rtnl: 2764 + rtnl_unregister_many(mpls_rtnl_msg_handlers); 2765 + out_unregister_rtnl_af: 2766 + rtnl_af_unregister(&mpls_af_ops); 2767 + dev_remove_pack(&mpls_packet_type); 2776 2768 out_unregister_pernet: 2777 2769 unregister_pernet_subsys(&mpls_net_ops); 2778 2770 goto out;
+2
net/mptcp/mib.c
··· 32 32 SNMP_MIB_ITEM("MPJoinSynTxBindErr", MPTCP_MIB_JOINSYNTXBINDERR), 33 33 SNMP_MIB_ITEM("MPJoinSynTxConnectErr", MPTCP_MIB_JOINSYNTXCONNECTERR), 34 34 SNMP_MIB_ITEM("DSSNotMatching", MPTCP_MIB_DSSNOMATCH), 35 + SNMP_MIB_ITEM("DSSCorruptionFallback", MPTCP_MIB_DSSCORRUPTIONFALLBACK), 36 + SNMP_MIB_ITEM("DSSCorruptionReset", MPTCP_MIB_DSSCORRUPTIONRESET), 35 37 SNMP_MIB_ITEM("InfiniteMapTx", MPTCP_MIB_INFINITEMAPTX), 36 38 SNMP_MIB_ITEM("InfiniteMapRx", MPTCP_MIB_INFINITEMAPRX), 37 39 SNMP_MIB_ITEM("DSSNoMatchTCP", MPTCP_MIB_DSSTCPMISMATCH),
+2
net/mptcp/mib.h
··· 27 27 MPTCP_MIB_JOINSYNTXBINDERR, /* Not able to bind() the address when sending a SYN + MP_JOIN */ 28 28 MPTCP_MIB_JOINSYNTXCONNECTERR, /* Not able to connect() when sending a SYN + MP_JOIN */ 29 29 MPTCP_MIB_DSSNOMATCH, /* Received a new mapping that did not match the previous one */ 30 + MPTCP_MIB_DSSCORRUPTIONFALLBACK,/* DSS corruption detected, fallback */ 31 + MPTCP_MIB_DSSCORRUPTIONRESET, /* DSS corruption detected, MPJ subflow reset */ 30 32 MPTCP_MIB_INFINITEMAPTX, /* Sent an infinite mapping */ 31 33 MPTCP_MIB_INFINITEMAPRX, /* Received an infinite mapping */ 32 34 MPTCP_MIB_DSSTCPMISMATCH, /* DSS-mapping did not map with TCP's sequence numbers */
+2 -1
net/mptcp/pm_netlink.c
··· 860 860 int how = RCV_SHUTDOWN | SEND_SHUTDOWN; 861 861 u8 id = subflow_get_local_id(subflow); 862 862 863 - if (inet_sk_state_load(ssk) == TCP_CLOSE) 863 + if ((1 << inet_sk_state_load(ssk)) & 864 + (TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | TCPF_CLOSING | TCPF_CLOSE)) 864 865 continue; 865 866 if (rm_type == MPTCP_MIB_RMADDR && remote_id != rm_id) 866 867 continue;
+21 -3
net/mptcp/protocol.c
··· 620 620 return ret; 621 621 } 622 622 623 + static void mptcp_dss_corruption(struct mptcp_sock *msk, struct sock *ssk) 624 + { 625 + if (READ_ONCE(msk->allow_infinite_fallback)) { 626 + MPTCP_INC_STATS(sock_net(ssk), 627 + MPTCP_MIB_DSSCORRUPTIONFALLBACK); 628 + mptcp_do_fallback(ssk); 629 + } else { 630 + MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_DSSCORRUPTIONRESET); 631 + mptcp_subflow_reset(ssk); 632 + } 633 + } 634 + 623 635 static bool __mptcp_move_skbs_from_subflow(struct mptcp_sock *msk, 624 636 struct sock *ssk, 625 637 unsigned int *bytes) ··· 704 692 moved += len; 705 693 seq += len; 706 694 707 - if (WARN_ON_ONCE(map_remaining < len)) 708 - break; 695 + if (unlikely(map_remaining < len)) { 696 + DEBUG_NET_WARN_ON_ONCE(1); 697 + mptcp_dss_corruption(msk, ssk); 698 + } 709 699 } else { 710 - WARN_ON_ONCE(!fin); 700 + if (unlikely(!fin)) { 701 + DEBUG_NET_WARN_ON_ONCE(1); 702 + mptcp_dss_corruption(msk, ssk); 703 + } 704 + 711 705 sk_eat_skb(ssk, skb); 712 706 done = true; 713 707 }
+4 -2
net/mptcp/subflow.c
··· 975 975 unsigned int skb_consumed; 976 976 977 977 skb_consumed = tcp_sk(ssk)->copied_seq - TCP_SKB_CB(skb)->seq; 978 - if (WARN_ON_ONCE(skb_consumed >= skb->len)) 978 + if (unlikely(skb_consumed >= skb->len)) { 979 + DEBUG_NET_WARN_ON_ONCE(1); 979 980 return true; 981 + } 980 982 981 983 return skb->len - skb_consumed <= subflow->map_data_len - 982 984 mptcp_subflow_get_map_offset(subflow); ··· 1282 1280 else if (READ_ONCE(msk->csum_enabled)) 1283 1281 return !subflow->valid_csum_seen; 1284 1282 else 1285 - return !subflow->fully_established; 1283 + return READ_ONCE(msk->allow_infinite_fallback); 1286 1284 } 1287 1285 1288 1286 static void mptcp_subflow_fail(struct mptcp_sock *msk, struct sock *ssk)
+23 -10
net/netfilter/xt_CHECKSUM.c
··· 63 63 return 0; 64 64 } 65 65 66 - static struct xt_target checksum_tg_reg __read_mostly = { 67 - .name = "CHECKSUM", 68 - .family = NFPROTO_UNSPEC, 69 - .target = checksum_tg, 70 - .targetsize = sizeof(struct xt_CHECKSUM_info), 71 - .table = "mangle", 72 - .checkentry = checksum_tg_check, 73 - .me = THIS_MODULE, 66 + static struct xt_target checksum_tg_reg[] __read_mostly = { 67 + { 68 + .name = "CHECKSUM", 69 + .family = NFPROTO_IPV4, 70 + .target = checksum_tg, 71 + .targetsize = sizeof(struct xt_CHECKSUM_info), 72 + .table = "mangle", 73 + .checkentry = checksum_tg_check, 74 + .me = THIS_MODULE, 75 + }, 76 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 77 + { 78 + .name = "CHECKSUM", 79 + .family = NFPROTO_IPV6, 80 + .target = checksum_tg, 81 + .targetsize = sizeof(struct xt_CHECKSUM_info), 82 + .table = "mangle", 83 + .checkentry = checksum_tg_check, 84 + .me = THIS_MODULE, 85 + }, 86 + #endif 74 87 }; 75 88 76 89 static int __init checksum_tg_init(void) 77 90 { 78 - return xt_register_target(&checksum_tg_reg); 91 + return xt_register_targets(checksum_tg_reg, ARRAY_SIZE(checksum_tg_reg)); 79 92 } 80 93 81 94 static void __exit checksum_tg_exit(void) 82 95 { 83 - xt_unregister_target(&checksum_tg_reg); 96 + xt_unregister_targets(checksum_tg_reg, ARRAY_SIZE(checksum_tg_reg)); 84 97 } 85 98 86 99 module_init(checksum_tg_init);
+14 -2
net/netfilter/xt_CLASSIFY.c
··· 38 38 { 39 39 .name = "CLASSIFY", 40 40 .revision = 0, 41 - .family = NFPROTO_UNSPEC, 41 + .family = NFPROTO_IPV4, 42 42 .hooks = (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_FORWARD) | 43 - (1 << NF_INET_POST_ROUTING), 43 + (1 << NF_INET_POST_ROUTING), 44 44 .target = classify_tg, 45 45 .targetsize = sizeof(struct xt_classify_target_info), 46 46 .me = THIS_MODULE, ··· 54 54 .targetsize = sizeof(struct xt_classify_target_info), 55 55 .me = THIS_MODULE, 56 56 }, 57 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 58 + { 59 + .name = "CLASSIFY", 60 + .revision = 0, 61 + .family = NFPROTO_IPV6, 62 + .hooks = (1 << NF_INET_LOCAL_OUT) | (1 << NF_INET_FORWARD) | 63 + (1 << NF_INET_POST_ROUTING), 64 + .target = classify_tg, 65 + .targetsize = sizeof(struct xt_classify_target_info), 66 + .me = THIS_MODULE, 67 + }, 68 + #endif 57 69 }; 58 70 59 71 static int __init classify_tg_init(void)
+25 -11
net/netfilter/xt_CONNSECMARK.c
··· 114 114 nf_ct_netns_put(par->net, par->family); 115 115 } 116 116 117 - static struct xt_target connsecmark_tg_reg __read_mostly = { 118 - .name = "CONNSECMARK", 119 - .revision = 0, 120 - .family = NFPROTO_UNSPEC, 121 - .checkentry = connsecmark_tg_check, 122 - .destroy = connsecmark_tg_destroy, 123 - .target = connsecmark_tg, 124 - .targetsize = sizeof(struct xt_connsecmark_target_info), 125 - .me = THIS_MODULE, 117 + static struct xt_target connsecmark_tg_reg[] __read_mostly = { 118 + { 119 + .name = "CONNSECMARK", 120 + .revision = 0, 121 + .family = NFPROTO_IPV4, 122 + .checkentry = connsecmark_tg_check, 123 + .destroy = connsecmark_tg_destroy, 124 + .target = connsecmark_tg, 125 + .targetsize = sizeof(struct xt_connsecmark_target_info), 126 + .me = THIS_MODULE, 127 + }, 128 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 129 + { 130 + .name = "CONNSECMARK", 131 + .revision = 0, 132 + .family = NFPROTO_IPV6, 133 + .checkentry = connsecmark_tg_check, 134 + .destroy = connsecmark_tg_destroy, 135 + .target = connsecmark_tg, 136 + .targetsize = sizeof(struct xt_connsecmark_target_info), 137 + .me = THIS_MODULE, 138 + }, 139 + #endif 126 140 }; 127 141 128 142 static int __init connsecmark_tg_init(void) 129 143 { 130 - return xt_register_target(&connsecmark_tg_reg); 144 + return xt_register_targets(connsecmark_tg_reg, ARRAY_SIZE(connsecmark_tg_reg)); 131 145 } 132 146 133 147 static void __exit connsecmark_tg_exit(void) 134 148 { 135 - xt_unregister_target(&connsecmark_tg_reg); 149 + xt_unregister_targets(connsecmark_tg_reg, ARRAY_SIZE(connsecmark_tg_reg)); 136 150 } 137 151 138 152 module_init(connsecmark_tg_init);
+90 -58
net/netfilter/xt_CT.c
··· 313 313 xt_ct_tg_destroy(par, par->targinfo); 314 314 } 315 315 316 - static struct xt_target xt_ct_tg_reg[] __read_mostly = { 317 - { 318 - .name = "CT", 319 - .family = NFPROTO_UNSPEC, 320 - .targetsize = sizeof(struct xt_ct_target_info), 321 - .usersize = offsetof(struct xt_ct_target_info, ct), 322 - .checkentry = xt_ct_tg_check_v0, 323 - .destroy = xt_ct_tg_destroy_v0, 324 - .target = xt_ct_target_v0, 325 - .table = "raw", 326 - .me = THIS_MODULE, 327 - }, 328 - { 329 - .name = "CT", 330 - .family = NFPROTO_UNSPEC, 331 - .revision = 1, 332 - .targetsize = sizeof(struct xt_ct_target_info_v1), 333 - .usersize = offsetof(struct xt_ct_target_info, ct), 334 - .checkentry = xt_ct_tg_check_v1, 335 - .destroy = xt_ct_tg_destroy_v1, 336 - .target = xt_ct_target_v1, 337 - .table = "raw", 338 - .me = THIS_MODULE, 339 - }, 340 - { 341 - .name = "CT", 342 - .family = NFPROTO_UNSPEC, 343 - .revision = 2, 344 - .targetsize = sizeof(struct xt_ct_target_info_v1), 345 - .usersize = offsetof(struct xt_ct_target_info, ct), 346 - .checkentry = xt_ct_tg_check_v2, 347 - .destroy = xt_ct_tg_destroy_v1, 348 - .target = xt_ct_target_v1, 349 - .table = "raw", 350 - .me = THIS_MODULE, 351 - }, 352 - }; 353 - 354 316 static unsigned int 355 317 notrack_tg(struct sk_buff *skb, const struct xt_action_param *par) 356 318 { ··· 325 363 return XT_CONTINUE; 326 364 } 327 365 328 - static struct xt_target notrack_tg_reg __read_mostly = { 329 - .name = "NOTRACK", 330 - .revision = 0, 331 - .family = NFPROTO_UNSPEC, 332 - .target = notrack_tg, 333 - .table = "raw", 334 - .me = THIS_MODULE, 366 + static struct xt_target xt_ct_tg_reg[] __read_mostly = { 367 + { 368 + .name = "NOTRACK", 369 + .revision = 0, 370 + .family = NFPROTO_IPV4, 371 + .target = notrack_tg, 372 + .table = "raw", 373 + .me = THIS_MODULE, 374 + }, 375 + { 376 + .name = "CT", 377 + .family = NFPROTO_IPV4, 378 + .targetsize = sizeof(struct xt_ct_target_info), 379 + .usersize = offsetof(struct xt_ct_target_info, ct), 380 + .checkentry = xt_ct_tg_check_v0, 381 + .destroy = xt_ct_tg_destroy_v0, 382 + .target = xt_ct_target_v0, 383 + .table = "raw", 384 + .me = THIS_MODULE, 385 + }, 386 + { 387 + .name = "CT", 388 + .family = NFPROTO_IPV4, 389 + .revision = 1, 390 + .targetsize = sizeof(struct xt_ct_target_info_v1), 391 + .usersize = offsetof(struct xt_ct_target_info, ct), 392 + .checkentry = xt_ct_tg_check_v1, 393 + .destroy = xt_ct_tg_destroy_v1, 394 + .target = xt_ct_target_v1, 395 + .table = "raw", 396 + .me = THIS_MODULE, 397 + }, 398 + { 399 + .name = "CT", 400 + .family = NFPROTO_IPV4, 401 + .revision = 2, 402 + .targetsize = sizeof(struct xt_ct_target_info_v1), 403 + .usersize = offsetof(struct xt_ct_target_info, ct), 404 + .checkentry = xt_ct_tg_check_v2, 405 + .destroy = xt_ct_tg_destroy_v1, 406 + .target = xt_ct_target_v1, 407 + .table = "raw", 408 + .me = THIS_MODULE, 409 + }, 410 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 411 + { 412 + .name = "NOTRACK", 413 + .revision = 0, 414 + .family = NFPROTO_IPV6, 415 + .target = notrack_tg, 416 + .table = "raw", 417 + .me = THIS_MODULE, 418 + }, 419 + { 420 + .name = "CT", 421 + .family = NFPROTO_IPV6, 422 + .targetsize = sizeof(struct xt_ct_target_info), 423 + .usersize = offsetof(struct xt_ct_target_info, ct), 424 + .checkentry = xt_ct_tg_check_v0, 425 + .destroy = xt_ct_tg_destroy_v0, 426 + .target = xt_ct_target_v0, 427 + .table = "raw", 428 + .me = THIS_MODULE, 429 + }, 430 + { 431 + .name = "CT", 432 + .family = NFPROTO_IPV6, 433 + .revision = 1, 434 + .targetsize = sizeof(struct xt_ct_target_info_v1), 435 + .usersize = offsetof(struct xt_ct_target_info, ct), 436 + .checkentry = xt_ct_tg_check_v1, 437 + .destroy = xt_ct_tg_destroy_v1, 438 + .target = xt_ct_target_v1, 439 + .table = "raw", 440 + .me = THIS_MODULE, 441 + }, 442 + { 443 + .name = "CT", 444 + .family = NFPROTO_IPV6, 445 + .revision = 2, 446 + .targetsize = sizeof(struct xt_ct_target_info_v1), 447 + .usersize = offsetof(struct xt_ct_target_info, ct), 448 + .checkentry = xt_ct_tg_check_v2, 449 + .destroy = xt_ct_tg_destroy_v1, 450 + .target = xt_ct_target_v1, 451 + .table = "raw", 452 + .me = THIS_MODULE, 453 + }, 454 + #endif 335 455 }; 336 456 337 457 static int __init xt_ct_tg_init(void) 338 458 { 339 - int ret; 340 - 341 - ret = xt_register_target(&notrack_tg_reg); 342 - if (ret < 0) 343 - return ret; 344 - 345 - ret = xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 346 - if (ret < 0) { 347 - xt_unregister_target(&notrack_tg_reg); 348 - return ret; 349 - } 350 - return 0; 459 + return xt_register_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 351 460 } 352 461 353 462 static void __exit xt_ct_tg_exit(void) 354 463 { 355 464 xt_unregister_targets(xt_ct_tg_reg, ARRAY_SIZE(xt_ct_tg_reg)); 356 - xt_unregister_target(&notrack_tg_reg); 357 465 } 358 466 359 467 module_init(xt_ct_tg_init);
+40 -19
net/netfilter/xt_IDLETIMER.c
··· 458 458 459 459 static struct xt_target idletimer_tg[] __read_mostly = { 460 460 { 461 - .name = "IDLETIMER", 462 - .family = NFPROTO_UNSPEC, 463 - .target = idletimer_tg_target, 464 - .targetsize = sizeof(struct idletimer_tg_info), 465 - .usersize = offsetof(struct idletimer_tg_info, timer), 466 - .checkentry = idletimer_tg_checkentry, 467 - .destroy = idletimer_tg_destroy, 468 - .me = THIS_MODULE, 461 + .name = "IDLETIMER", 462 + .family = NFPROTO_IPV4, 463 + .target = idletimer_tg_target, 464 + .targetsize = sizeof(struct idletimer_tg_info), 465 + .usersize = offsetof(struct idletimer_tg_info, timer), 466 + .checkentry = idletimer_tg_checkentry, 467 + .destroy = idletimer_tg_destroy, 468 + .me = THIS_MODULE, 469 469 }, 470 470 { 471 - .name = "IDLETIMER", 472 - .family = NFPROTO_UNSPEC, 473 - .revision = 1, 474 - .target = idletimer_tg_target_v1, 475 - .targetsize = sizeof(struct idletimer_tg_info_v1), 476 - .usersize = offsetof(struct idletimer_tg_info_v1, timer), 477 - .checkentry = idletimer_tg_checkentry_v1, 478 - .destroy = idletimer_tg_destroy_v1, 479 - .me = THIS_MODULE, 471 + .name = "IDLETIMER", 472 + .family = NFPROTO_IPV4, 473 + .revision = 1, 474 + .target = idletimer_tg_target_v1, 475 + .targetsize = sizeof(struct idletimer_tg_info_v1), 476 + .usersize = offsetof(struct idletimer_tg_info_v1, timer), 477 + .checkentry = idletimer_tg_checkentry_v1, 478 + .destroy = idletimer_tg_destroy_v1, 479 + .me = THIS_MODULE, 480 480 }, 481 - 482 - 481 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 482 + { 483 + .name = "IDLETIMER", 484 + .family = NFPROTO_IPV6, 485 + .target = idletimer_tg_target, 486 + .targetsize = sizeof(struct idletimer_tg_info), 487 + .usersize = offsetof(struct idletimer_tg_info, timer), 488 + .checkentry = idletimer_tg_checkentry, 489 + .destroy = idletimer_tg_destroy, 490 + .me = THIS_MODULE, 491 + }, 492 + { 493 + .name = "IDLETIMER", 494 + .family = NFPROTO_IPV6, 495 + .revision = 1, 496 + .target = idletimer_tg_target_v1, 497 + .targetsize = sizeof(struct idletimer_tg_info_v1), 498 + .usersize = offsetof(struct idletimer_tg_info_v1, timer), 499 + .checkentry = idletimer_tg_checkentry_v1, 500 + .destroy = idletimer_tg_destroy_v1, 501 + .me = THIS_MODULE, 502 + }, 503 + #endif 483 504 }; 484 505 485 506 static struct class *idletimer_tg_class;
+27 -12
net/netfilter/xt_LED.c
··· 175 175 kfree(ledinternal); 176 176 } 177 177 178 - static struct xt_target led_tg_reg __read_mostly = { 179 - .name = "LED", 180 - .revision = 0, 181 - .family = NFPROTO_UNSPEC, 182 - .target = led_tg, 183 - .targetsize = sizeof(struct xt_led_info), 184 - .usersize = offsetof(struct xt_led_info, internal_data), 185 - .checkentry = led_tg_check, 186 - .destroy = led_tg_destroy, 187 - .me = THIS_MODULE, 178 + static struct xt_target led_tg_reg[] __read_mostly = { 179 + { 180 + .name = "LED", 181 + .revision = 0, 182 + .family = NFPROTO_IPV4, 183 + .target = led_tg, 184 + .targetsize = sizeof(struct xt_led_info), 185 + .usersize = offsetof(struct xt_led_info, internal_data), 186 + .checkentry = led_tg_check, 187 + .destroy = led_tg_destroy, 188 + .me = THIS_MODULE, 189 + }, 190 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 191 + { 192 + .name = "LED", 193 + .revision = 0, 194 + .family = NFPROTO_IPV6, 195 + .target = led_tg, 196 + .targetsize = sizeof(struct xt_led_info), 197 + .usersize = offsetof(struct xt_led_info, internal_data), 198 + .checkentry = led_tg_check, 199 + .destroy = led_tg_destroy, 200 + .me = THIS_MODULE, 201 + }, 202 + #endif 188 203 }; 189 204 190 205 static int __init led_tg_init(void) 191 206 { 192 - return xt_register_target(&led_tg_reg); 207 + return xt_register_targets(led_tg_reg, ARRAY_SIZE(led_tg_reg)); 193 208 } 194 209 195 210 static void __exit led_tg_exit(void) 196 211 { 197 - xt_unregister_target(&led_tg_reg); 212 + xt_unregister_targets(led_tg_reg, ARRAY_SIZE(led_tg_reg)); 198 213 } 199 214 200 215 module_init(led_tg_init);
+25 -11
net/netfilter/xt_NFLOG.c
··· 64 64 nf_logger_put(par->family, NF_LOG_TYPE_ULOG); 65 65 } 66 66 67 - static struct xt_target nflog_tg_reg __read_mostly = { 68 - .name = "NFLOG", 69 - .revision = 0, 70 - .family = NFPROTO_UNSPEC, 71 - .checkentry = nflog_tg_check, 72 - .destroy = nflog_tg_destroy, 73 - .target = nflog_tg, 74 - .targetsize = sizeof(struct xt_nflog_info), 75 - .me = THIS_MODULE, 67 + static struct xt_target nflog_tg_reg[] __read_mostly = { 68 + { 69 + .name = "NFLOG", 70 + .revision = 0, 71 + .family = NFPROTO_IPV4, 72 + .checkentry = nflog_tg_check, 73 + .destroy = nflog_tg_destroy, 74 + .target = nflog_tg, 75 + .targetsize = sizeof(struct xt_nflog_info), 76 + .me = THIS_MODULE, 77 + }, 78 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 79 + { 80 + .name = "NFLOG", 81 + .revision = 0, 82 + .family = NFPROTO_IPV4, 83 + .checkentry = nflog_tg_check, 84 + .destroy = nflog_tg_destroy, 85 + .target = nflog_tg, 86 + .targetsize = sizeof(struct xt_nflog_info), 87 + .me = THIS_MODULE, 88 + }, 89 + #endif 76 90 }; 77 91 78 92 static int __init nflog_tg_init(void) 79 93 { 80 - return xt_register_target(&nflog_tg_reg); 94 + return xt_register_targets(nflog_tg_reg, ARRAY_SIZE(nflog_tg_reg)); 81 95 } 82 96 83 97 static void __exit nflog_tg_exit(void) 84 98 { 85 - xt_unregister_target(&nflog_tg_reg); 99 + xt_unregister_targets(nflog_tg_reg, ARRAY_SIZE(nflog_tg_reg)); 86 100 } 87 101 88 102 module_init(nflog_tg_init);
+27 -12
net/netfilter/xt_RATEEST.c
··· 179 179 xt_rateest_put(par->net, info->est); 180 180 } 181 181 182 - static struct xt_target xt_rateest_tg_reg __read_mostly = { 183 - .name = "RATEEST", 184 - .revision = 0, 185 - .family = NFPROTO_UNSPEC, 186 - .target = xt_rateest_tg, 187 - .checkentry = xt_rateest_tg_checkentry, 188 - .destroy = xt_rateest_tg_destroy, 189 - .targetsize = sizeof(struct xt_rateest_target_info), 190 - .usersize = offsetof(struct xt_rateest_target_info, est), 191 - .me = THIS_MODULE, 182 + static struct xt_target xt_rateest_tg_reg[] __read_mostly = { 183 + { 184 + .name = "RATEEST", 185 + .revision = 0, 186 + .family = NFPROTO_IPV4, 187 + .target = xt_rateest_tg, 188 + .checkentry = xt_rateest_tg_checkentry, 189 + .destroy = xt_rateest_tg_destroy, 190 + .targetsize = sizeof(struct xt_rateest_target_info), 191 + .usersize = offsetof(struct xt_rateest_target_info, est), 192 + .me = THIS_MODULE, 193 + }, 194 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 195 + { 196 + .name = "RATEEST", 197 + .revision = 0, 198 + .family = NFPROTO_IPV6, 199 + .target = xt_rateest_tg, 200 + .checkentry = xt_rateest_tg_checkentry, 201 + .destroy = xt_rateest_tg_destroy, 202 + .targetsize = sizeof(struct xt_rateest_target_info), 203 + .usersize = offsetof(struct xt_rateest_target_info, est), 204 + .me = THIS_MODULE, 205 + }, 206 + #endif 192 207 }; 193 208 194 209 static __net_init int xt_rateest_net_init(struct net *net) ··· 229 214 230 215 if (err) 231 216 return err; 232 - return xt_register_target(&xt_rateest_tg_reg); 217 + return xt_register_targets(xt_rateest_tg_reg, ARRAY_SIZE(xt_rateest_tg_reg)); 233 218 } 234 219 235 220 static void __exit xt_rateest_tg_fini(void) 236 221 { 237 - xt_unregister_target(&xt_rateest_tg_reg); 222 + xt_unregister_targets(xt_rateest_tg_reg, ARRAY_SIZE(xt_rateest_tg_reg)); 238 223 unregister_pernet_subsys(&xt_rateest_net_ops); 239 224 } 240 225
+25 -2
net/netfilter/xt_SECMARK.c
··· 157 157 { 158 158 .name = "SECMARK", 159 159 .revision = 0, 160 - .family = NFPROTO_UNSPEC, 160 + .family = NFPROTO_IPV4, 161 161 .checkentry = secmark_tg_check_v0, 162 162 .destroy = secmark_tg_destroy, 163 163 .target = secmark_tg_v0, ··· 167 167 { 168 168 .name = "SECMARK", 169 169 .revision = 1, 170 - .family = NFPROTO_UNSPEC, 170 + .family = NFPROTO_IPV4, 171 171 .checkentry = secmark_tg_check_v1, 172 172 .destroy = secmark_tg_destroy, 173 173 .target = secmark_tg_v1, ··· 175 175 .usersize = offsetof(struct xt_secmark_target_info_v1, secid), 176 176 .me = THIS_MODULE, 177 177 }, 178 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 179 + { 180 + .name = "SECMARK", 181 + .revision = 0, 182 + .family = NFPROTO_IPV6, 183 + .checkentry = secmark_tg_check_v0, 184 + .destroy = secmark_tg_destroy, 185 + .target = secmark_tg_v0, 186 + .targetsize = sizeof(struct xt_secmark_target_info), 187 + .me = THIS_MODULE, 188 + }, 189 + { 190 + .name = "SECMARK", 191 + .revision = 1, 192 + .family = NFPROTO_IPV6, 193 + .checkentry = secmark_tg_check_v1, 194 + .destroy = secmark_tg_destroy, 195 + .target = secmark_tg_v1, 196 + .targetsize = sizeof(struct xt_secmark_target_info_v1), 197 + .usersize = offsetof(struct xt_secmark_target_info_v1, secid), 198 + .me = THIS_MODULE, 199 + }, 200 + #endif 178 201 }; 179 202 180 203 static int __init secmark_tg_init(void)
+24 -11
net/netfilter/xt_TRACE.c
··· 29 29 return XT_CONTINUE; 30 30 } 31 31 32 - static struct xt_target trace_tg_reg __read_mostly = { 33 - .name = "TRACE", 34 - .revision = 0, 35 - .family = NFPROTO_UNSPEC, 36 - .table = "raw", 37 - .target = trace_tg, 38 - .checkentry = trace_tg_check, 39 - .destroy = trace_tg_destroy, 40 - .me = THIS_MODULE, 32 + static struct xt_target trace_tg_reg[] __read_mostly = { 33 + { 34 + .name = "TRACE", 35 + .revision = 0, 36 + .family = NFPROTO_IPV4, 37 + .table = "raw", 38 + .target = trace_tg, 39 + .checkentry = trace_tg_check, 40 + .destroy = trace_tg_destroy, 41 + .me = THIS_MODULE, 42 + }, 43 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 44 + { 45 + .name = "TRACE", 46 + .revision = 0, 47 + .family = NFPROTO_IPV6, 48 + .table = "raw", 49 + .target = trace_tg, 50 + .checkentry = trace_tg_check, 51 + .destroy = trace_tg_destroy, 52 + }, 53 + #endif 41 54 }; 42 55 43 56 static int __init trace_tg_init(void) 44 57 { 45 - return xt_register_target(&trace_tg_reg); 58 + return xt_register_targets(trace_tg_reg, ARRAY_SIZE(trace_tg_reg)); 46 59 } 47 60 48 61 static void __exit trace_tg_exit(void) 49 62 { 50 - xt_unregister_target(&trace_tg_reg); 63 + xt_unregister_targets(trace_tg_reg, ARRAY_SIZE(trace_tg_reg)); 51 64 } 52 65 53 66 module_init(trace_tg_init);
+13 -2
net/netfilter/xt_addrtype.c
··· 208 208 }, 209 209 { 210 210 .name = "addrtype", 211 - .family = NFPROTO_UNSPEC, 211 + .family = NFPROTO_IPV4, 212 212 .revision = 1, 213 213 .match = addrtype_mt_v1, 214 214 .checkentry = addrtype_mt_checkentry_v1, 215 215 .matchsize = sizeof(struct xt_addrtype_info_v1), 216 216 .me = THIS_MODULE 217 - } 217 + }, 218 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 219 + { 220 + .name = "addrtype", 221 + .family = NFPROTO_IPV6, 222 + .revision = 1, 223 + .match = addrtype_mt_v1, 224 + .checkentry = addrtype_mt_checkentry_v1, 225 + .matchsize = sizeof(struct xt_addrtype_info_v1), 226 + .me = THIS_MODULE 227 + }, 228 + #endif 218 229 }; 219 230 220 231 static int __init addrtype_mt_init(void)
+23 -10
net/netfilter/xt_cluster.c
··· 146 146 nf_ct_netns_put(par->net, par->family); 147 147 } 148 148 149 - static struct xt_match xt_cluster_match __read_mostly = { 150 - .name = "cluster", 151 - .family = NFPROTO_UNSPEC, 152 - .match = xt_cluster_mt, 153 - .checkentry = xt_cluster_mt_checkentry, 154 - .matchsize = sizeof(struct xt_cluster_match_info), 155 - .destroy = xt_cluster_mt_destroy, 156 - .me = THIS_MODULE, 149 + static struct xt_match xt_cluster_match[] __read_mostly = { 150 + { 151 + .name = "cluster", 152 + .family = NFPROTO_IPV4, 153 + .match = xt_cluster_mt, 154 + .checkentry = xt_cluster_mt_checkentry, 155 + .matchsize = sizeof(struct xt_cluster_match_info), 156 + .destroy = xt_cluster_mt_destroy, 157 + .me = THIS_MODULE, 158 + }, 159 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 160 + { 161 + .name = "cluster", 162 + .family = NFPROTO_IPV6, 163 + .match = xt_cluster_mt, 164 + .checkentry = xt_cluster_mt_checkentry, 165 + .matchsize = sizeof(struct xt_cluster_match_info), 166 + .destroy = xt_cluster_mt_destroy, 167 + .me = THIS_MODULE, 168 + }, 169 + #endif 157 170 }; 158 171 159 172 static int __init xt_cluster_mt_init(void) 160 173 { 161 - return xt_register_match(&xt_cluster_match); 174 + return xt_register_matches(xt_cluster_match, ARRAY_SIZE(xt_cluster_match)); 162 175 } 163 176 164 177 static void __exit xt_cluster_mt_fini(void) 165 178 { 166 - xt_unregister_match(&xt_cluster_match); 179 + xt_unregister_matches(xt_cluster_match, ARRAY_SIZE(xt_cluster_match)); 167 180 } 168 181 169 182 MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
+3 -1
net/netfilter/xt_connbytes.c
··· 111 111 return -EINVAL; 112 112 113 113 ret = nf_ct_netns_get(par->net, par->family); 114 - if (ret < 0) 114 + if (ret < 0) { 115 115 pr_info_ratelimited("cannot load conntrack support for proto=%u\n", 116 116 par->family); 117 + return ret; 118 + } 117 119 118 120 /* 119 121 * This filter cannot function correctly unless connection tracking
+27 -12
net/netfilter/xt_connlimit.c
··· 117 117 nf_ct_netns_put(par->net, par->family); 118 118 } 119 119 120 - static struct xt_match connlimit_mt_reg __read_mostly = { 121 - .name = "connlimit", 122 - .revision = 1, 123 - .family = NFPROTO_UNSPEC, 124 - .checkentry = connlimit_mt_check, 125 - .match = connlimit_mt, 126 - .matchsize = sizeof(struct xt_connlimit_info), 127 - .usersize = offsetof(struct xt_connlimit_info, data), 128 - .destroy = connlimit_mt_destroy, 129 - .me = THIS_MODULE, 120 + static struct xt_match connlimit_mt_reg[] __read_mostly = { 121 + { 122 + .name = "connlimit", 123 + .revision = 1, 124 + .family = NFPROTO_IPV4, 125 + .checkentry = connlimit_mt_check, 126 + .match = connlimit_mt, 127 + .matchsize = sizeof(struct xt_connlimit_info), 128 + .usersize = offsetof(struct xt_connlimit_info, data), 129 + .destroy = connlimit_mt_destroy, 130 + .me = THIS_MODULE, 131 + }, 132 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 133 + { 134 + .name = "connlimit", 135 + .revision = 1, 136 + .family = NFPROTO_IPV6, 137 + .checkentry = connlimit_mt_check, 138 + .match = connlimit_mt, 139 + .matchsize = sizeof(struct xt_connlimit_info), 140 + .usersize = offsetof(struct xt_connlimit_info, data), 141 + .destroy = connlimit_mt_destroy, 142 + .me = THIS_MODULE, 143 + }, 144 + #endif 130 145 }; 131 146 132 147 static int __init connlimit_mt_init(void) 133 148 { 134 - return xt_register_match(&connlimit_mt_reg); 149 + return xt_register_matches(connlimit_mt_reg, ARRAY_SIZE(connlimit_mt_reg)); 135 150 } 136 151 137 152 static void __exit connlimit_mt_exit(void) 138 153 { 139 - xt_unregister_match(&connlimit_mt_reg); 154 + xt_unregister_matches(connlimit_mt_reg, ARRAY_SIZE(connlimit_mt_reg)); 140 155 } 141 156 142 157 module_init(connlimit_mt_init);
+25 -3
net/netfilter/xt_connmark.c
··· 151 151 { 152 152 .name = "CONNMARK", 153 153 .revision = 1, 154 - .family = NFPROTO_UNSPEC, 154 + .family = NFPROTO_IPV4, 155 155 .checkentry = connmark_tg_check, 156 156 .target = connmark_tg, 157 157 .targetsize = sizeof(struct xt_connmark_tginfo1), ··· 161 161 { 162 162 .name = "CONNMARK", 163 163 .revision = 2, 164 - .family = NFPROTO_UNSPEC, 164 + .family = NFPROTO_IPV4, 165 165 .checkentry = connmark_tg_check, 166 166 .target = connmark_tg_v2, 167 167 .targetsize = sizeof(struct xt_connmark_tginfo2), 168 168 .destroy = connmark_tg_destroy, 169 169 .me = THIS_MODULE, 170 - } 170 + }, 171 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 172 + { 173 + .name = "CONNMARK", 174 + .revision = 1, 175 + .family = NFPROTO_IPV6, 176 + .checkentry = connmark_tg_check, 177 + .target = connmark_tg, 178 + .targetsize = sizeof(struct xt_connmark_tginfo1), 179 + .destroy = connmark_tg_destroy, 180 + .me = THIS_MODULE, 181 + }, 182 + { 183 + .name = "CONNMARK", 184 + .revision = 2, 185 + .family = NFPROTO_IPV6, 186 + .checkentry = connmark_tg_check, 187 + .target = connmark_tg_v2, 188 + .targetsize = sizeof(struct xt_connmark_tginfo2), 189 + .destroy = connmark_tg_destroy, 190 + .me = THIS_MODULE, 191 + }, 192 + #endif 171 193 }; 172 194 173 195 static struct xt_match connmark_mt_reg __read_mostly = {
+32 -10
net/netfilter/xt_mark.c
··· 39 39 return ((skb->mark & info->mask) == info->mark) ^ info->invert; 40 40 } 41 41 42 - static struct xt_target mark_tg_reg __read_mostly = { 43 - .name = "MARK", 44 - .revision = 2, 45 - .family = NFPROTO_UNSPEC, 46 - .target = mark_tg, 47 - .targetsize = sizeof(struct xt_mark_tginfo2), 48 - .me = THIS_MODULE, 42 + static struct xt_target mark_tg_reg[] __read_mostly = { 43 + { 44 + .name = "MARK", 45 + .revision = 2, 46 + .family = NFPROTO_IPV4, 47 + .target = mark_tg, 48 + .targetsize = sizeof(struct xt_mark_tginfo2), 49 + .me = THIS_MODULE, 50 + }, 51 + #if IS_ENABLED(CONFIG_IP_NF_ARPTABLES) 52 + { 53 + .name = "MARK", 54 + .revision = 2, 55 + .family = NFPROTO_ARP, 56 + .target = mark_tg, 57 + .targetsize = sizeof(struct xt_mark_tginfo2), 58 + .me = THIS_MODULE, 59 + }, 60 + #endif 61 + #if IS_ENABLED(CONFIG_IP6_NF_IPTABLES) 62 + { 63 + .name = "MARK", 64 + .revision = 2, 65 + .family = NFPROTO_IPV4, 66 + .target = mark_tg, 67 + .targetsize = sizeof(struct xt_mark_tginfo2), 68 + .me = THIS_MODULE, 69 + }, 70 + #endif 49 71 }; 50 72 51 73 static struct xt_match mark_mt_reg __read_mostly = { ··· 83 61 { 84 62 int ret; 85 63 86 - ret = xt_register_target(&mark_tg_reg); 64 + ret = xt_register_targets(mark_tg_reg, ARRAY_SIZE(mark_tg_reg)); 87 65 if (ret < 0) 88 66 return ret; 89 67 ret = xt_register_match(&mark_mt_reg); 90 68 if (ret < 0) { 91 - xt_unregister_target(&mark_tg_reg); 69 + xt_unregister_targets(mark_tg_reg, ARRAY_SIZE(mark_tg_reg)); 92 70 return ret; 93 71 } 94 72 return 0; ··· 97 75 static void __exit mark_mt_exit(void) 98 76 { 99 77 xt_unregister_match(&mark_mt_reg); 100 - xt_unregister_target(&mark_tg_reg); 78 + xt_unregister_targets(mark_tg_reg, ARRAY_SIZE(mark_tg_reg)); 101 79 } 102 80 103 81 module_init(mark_mt_init);
+2 -1
net/netlink/af_netlink.c
··· 2136 2136 { 2137 2137 struct sock *sk; 2138 2138 struct netlink_table *tbl = &nl_table[ksk->sk_protocol]; 2139 + struct hlist_node *tmp; 2139 2140 2140 - sk_for_each_bound(sk, &tbl->mc_list) 2141 + sk_for_each_bound_safe(sk, tmp, &tbl->mc_list) 2141 2142 netlink_update_socket_mc(nlk_sk(sk), group, 0); 2142 2143 } 2143 2144
+11 -17
net/phonet/pn_netlink.c
··· 285 285 return err; 286 286 } 287 287 288 + static const struct rtnl_msg_handler phonet_rtnl_msg_handlers[] __initdata_or_module = { 289 + {THIS_MODULE, PF_PHONET, RTM_NEWADDR, addr_doit, NULL, 0}, 290 + {THIS_MODULE, PF_PHONET, RTM_DELADDR, addr_doit, NULL, 0}, 291 + {THIS_MODULE, PF_PHONET, RTM_GETADDR, NULL, getaddr_dumpit, 0}, 292 + {THIS_MODULE, PF_PHONET, RTM_NEWROUTE, route_doit, NULL, 0}, 293 + {THIS_MODULE, PF_PHONET, RTM_DELROUTE, route_doit, NULL, 0}, 294 + {THIS_MODULE, PF_PHONET, RTM_GETROUTE, NULL, route_dumpit, 295 + RTNL_FLAG_DUMP_UNLOCKED}, 296 + }; 297 + 288 298 int __init phonet_netlink_register(void) 289 299 { 290 - int err = rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_NEWADDR, 291 - addr_doit, NULL, 0); 292 - if (err) 293 - return err; 294 - 295 - /* Further rtnl_register_module() cannot fail */ 296 - rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_DELADDR, 297 - addr_doit, NULL, 0); 298 - rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_GETADDR, 299 - NULL, getaddr_dumpit, 0); 300 - rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_NEWROUTE, 301 - route_doit, NULL, 0); 302 - rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_DELROUTE, 303 - route_doit, NULL, 0); 304 - rtnl_register_module(THIS_MODULE, PF_PHONET, RTM_GETROUTE, 305 - NULL, route_dumpit, RTNL_FLAG_DUMP_UNLOCKED); 306 - return 0; 300 + return rtnl_register_many(phonet_rtnl_msg_handlers); 307 301 }
+1 -1
net/rxrpc/ar-internal.h
··· 1056 1056 int rxrpc_io_thread(void *data); 1057 1057 static inline void rxrpc_wake_up_io_thread(struct rxrpc_local *local) 1058 1058 { 1059 - wake_up_process(local->io_thread); 1059 + wake_up_process(READ_ONCE(local->io_thread)); 1060 1060 } 1061 1061 1062 1062 static inline bool rxrpc_protocol_error(struct sk_buff *skb, enum rxrpc_abort_reason why)
+8 -2
net/rxrpc/io_thread.c
··· 27 27 { 28 28 struct sk_buff_head *rx_queue; 29 29 struct rxrpc_local *local = rcu_dereference_sk_user_data(udp_sk); 30 + struct task_struct *io_thread; 30 31 31 32 if (unlikely(!local)) { 33 + kfree_skb(skb); 34 + return 0; 35 + } 36 + io_thread = READ_ONCE(local->io_thread); 37 + if (!io_thread) { 32 38 kfree_skb(skb); 33 39 return 0; 34 40 } ··· 53 47 #endif 54 48 55 49 skb_queue_tail(rx_queue, skb); 56 - rxrpc_wake_up_io_thread(local); 50 + wake_up_process(io_thread); 57 51 return 0; 58 52 } 59 53 ··· 571 565 __set_current_state(TASK_RUNNING); 572 566 rxrpc_see_local(local, rxrpc_local_stop); 573 567 rxrpc_destroy_local(local); 574 - local->io_thread = NULL; 568 + WRITE_ONCE(local->io_thread, NULL); 575 569 rxrpc_see_local(local, rxrpc_local_stopped); 576 570 return 0; 577 571 }
+1 -1
net/rxrpc/local_object.c
··· 232 232 } 233 233 234 234 wait_for_completion(&local->io_thread_ready); 235 - local->io_thread = io_thread; 235 + WRITE_ONCE(local->io_thread, io_thread); 236 236 _leave(" = 0"); 237 237 return 0; 238 238
+5 -5
net/rxrpc/sendmsg.c
··· 303 303 sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk); 304 304 305 305 reload: 306 + txb = call->tx_pending; 307 + call->tx_pending = NULL; 308 + if (txb) 309 + rxrpc_see_txbuf(txb, rxrpc_txbuf_see_send_more); 310 + 306 311 ret = -EPIPE; 307 312 if (sk->sk_shutdown & SEND_SHUTDOWN) 308 313 goto maybe_error; ··· 333 328 if (!more && len - copied != call->tx_total_len) 334 329 goto maybe_error; 335 330 } 336 - 337 - txb = call->tx_pending; 338 - call->tx_pending = NULL; 339 - if (txb) 340 - rxrpc_see_txbuf(txb, rxrpc_txbuf_see_send_more); 341 331 342 332 do { 343 333 if (!txb) {
+6 -1
net/sched/sch_api.c
··· 593 593 pkt_len = 1; 594 594 qdisc_skb_cb(skb)->pkt_len = pkt_len; 595 595 } 596 - EXPORT_SYMBOL(__qdisc_calculate_pkt_len); 597 596 598 597 void qdisc_warn_nonwc(const char *txt, struct Qdisc *qdisc) 599 598 { ··· 1200 1201 return -EINVAL; 1201 1202 } 1202 1203 1204 + if (new && 1205 + !(parent->flags & TCQ_F_MQROOT) && 1206 + rcu_access_pointer(new->stab)) { 1207 + NL_SET_ERR_MSG(extack, "STAB not supported on a non root"); 1208 + return -EINVAL; 1209 + } 1203 1210 err = cops->graft(parent, cl, new, &old, extack); 1204 1211 if (err) 1205 1212 return err;
+13 -5
net/sctp/socket.c
··· 8531 8531 struct sctp_endpoint *ep = sp->ep; 8532 8532 struct crypto_shash *tfm = NULL; 8533 8533 char alg[32]; 8534 + int err; 8534 8535 8535 8536 /* Allocate HMAC for generating cookie. */ 8536 8537 if (!sp->hmac && sp->sctp_hmac_alg) { ··· 8559 8558 inet_sk_set_state(sk, SCTP_SS_LISTENING); 8560 8559 if (!ep->base.bind_addr.port) { 8561 8560 if (sctp_autobind(sk)) { 8562 - inet_sk_set_state(sk, SCTP_SS_CLOSED); 8563 - return -EAGAIN; 8561 + err = -EAGAIN; 8562 + goto err; 8564 8563 } 8565 8564 } else { 8566 8565 if (sctp_get_port(sk, inet_sk(sk)->inet_num)) { 8567 - inet_sk_set_state(sk, SCTP_SS_CLOSED); 8568 - return -EADDRINUSE; 8566 + err = -EADDRINUSE; 8567 + goto err; 8569 8568 } 8570 8569 } 8571 8570 8572 8571 WRITE_ONCE(sk->sk_max_ack_backlog, backlog); 8573 - return sctp_hash_endpoint(ep); 8572 + err = sctp_hash_endpoint(ep); 8573 + if (err) 8574 + goto err; 8575 + 8576 + return 0; 8577 + err: 8578 + inet_sk_set_state(sk, SCTP_SS_CLOSED); 8579 + return err; 8574 8580 } 8575 8581 8576 8582 /*
+11
net/smc/smc_inet.c
··· 108 108 }; 109 109 #endif /* CONFIG_IPV6 */ 110 110 111 + static unsigned int smc_sync_mss(struct sock *sk, u32 pmtu) 112 + { 113 + /* No need pass it through to clcsock, mss can always be set by 114 + * sock_create_kern or smc_setsockopt. 115 + */ 116 + return 0; 117 + } 118 + 111 119 static int smc_inet_init_sock(struct sock *sk) 112 120 { 113 121 struct net *net = sock_net(sk); 114 122 115 123 /* init common smc sock */ 116 124 smc_sk_init(net, sk, IPPROTO_SMC); 125 + 126 + inet_csk(sk)->icsk_sync_mss = smc_sync_mss; 127 + 117 128 /* create clcsock */ 118 129 return smc_create_clcsk(net, sk, sk->sk_family); 119 130 }
+6 -1
net/socket.c
··· 1574 1574 rcu_read_unlock(); 1575 1575 1576 1576 err = pf->create(net, sock, protocol, kern); 1577 - if (err < 0) 1577 + if (err < 0) { 1578 + /* ->create should release the allocated sock->sk object on error 1579 + * but it may leave the dangling pointer 1580 + */ 1581 + sock->sk = NULL; 1578 1582 goto out_module_put; 1583 + } 1579 1584 1580 1585 /* 1581 1586 * Now to bump the refcnt of the [loadable] module that owns this
+1
tools/testing/selftests/net/.gitignore
··· 16 16 ipv6_flowlabel 17 17 ipv6_flowlabel_mgr 18 18 log.txt 19 + msg_oob 19 20 msg_zerocopy 20 21 ncdevmem 21 22 nettest
+1 -1
tools/testing/selftests/net/forwarding/no_forwarding.sh
··· 202 202 ip link set $swp2 master br0 203 203 204 204 bridge vlan add dev $swp1 vid 1 pvid untagged 205 - bridge vlan add dev $swp1 vid 2 pvid untagged 205 + bridge vlan add dev $swp2 vid 2 pvid untagged 206 206 207 207 run_test "Switch ports in VLAN-aware bridge with different PVIDs" 208 208
+1
tools/testing/selftests/net/netfilter/Makefile
··· 31 31 TEST_PROGS += nft_tproxy_udp.sh 32 32 TEST_PROGS += nft_zones_many.sh 33 33 TEST_PROGS += rpath.sh 34 + TEST_PROGS += vxlan_mtu_frag.sh 34 35 TEST_PROGS += xt_string.sh 35 36 36 37 TEST_PROGS_EXTENDED = nft_concat_range_perf.sh
+2
tools/testing/selftests/net/netfilter/config
··· 7 7 CONFIG_BRIDGE_EBT_T_FILTER=m 8 8 CONFIG_BRIDGE_NETFILTER=m 9 9 CONFIG_BRIDGE_NF_EBTABLES=m 10 + CONFIG_BRIDGE_VLAN_FILTERING=y 10 11 CONFIG_CGROUP_BPF=y 11 12 CONFIG_DUMMY=m 12 13 CONFIG_INET_ESP=m ··· 85 84 CONFIG_NFT_TPROXY=m 86 85 CONFIG_VETH=m 87 86 CONFIG_VLAN_8021Q=m 87 + CONFIG_VXLAN=m 88 88 CONFIG_XFRM_USER=m 89 89 CONFIG_XFRM_STATISTICS=y 90 90 CONFIG_NET_PKTGEN=m
+33
tools/testing/selftests/net/netfilter/conntrack_vrf.sh
··· 32 32 33 33 IP0=172.30.30.1 34 34 IP1=172.30.30.2 35 + DUMMYNET=10.9.9 35 36 PFXL=30 36 37 ret=0 37 38 ··· 55 54 ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.default.rp_filter=0 56 55 ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.all.rp_filter=0 57 56 ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.all.rp_filter=0 57 + ip netns exec "$ns0" sysctl -q -w net.ipv4.conf.all.forwarding=1 58 58 59 59 if ! ip link add veth0 netns "$ns0" type veth peer name veth0 netns "$ns1" > /dev/null 2>&1; then 60 60 echo "SKIP: Could not add veth device" ··· 67 65 exit $ksft_skip 68 66 fi 69 67 68 + ip -net "$ns0" link add dummy0 type dummy 69 + 70 70 ip -net "$ns0" li set veth0 master tvrf 71 + ip -net "$ns0" li set dummy0 master tvrf 71 72 ip -net "$ns0" li set tvrf up 72 73 ip -net "$ns0" li set veth0 up 74 + ip -net "$ns0" li set dummy0 up 73 75 ip -net "$ns1" li set veth0 up 74 76 75 77 ip -net "$ns0" addr add $IP0/$PFXL dev veth0 76 78 ip -net "$ns1" addr add $IP1/$PFXL dev veth0 79 + ip -net "$ns0" addr add $DUMMYNET.1/$PFXL dev dummy0 77 80 78 81 listener_ready() 79 82 { ··· 219 212 fi 220 213 } 221 214 215 + test_fib() 216 + { 217 + ip netns exec "$ns0" nft -f - <<EOF 218 + flush ruleset 219 + table ip t { 220 + counter fibcount { } 221 + 222 + chain prerouting { 223 + type filter hook prerouting priority 0; 224 + meta iifname veth0 ip daddr $DUMMYNET.2 fib daddr oif dummy0 counter name fibcount notrack 225 + } 226 + } 227 + EOF 228 + ip -net "$ns1" route add 10.9.9.0/24 via "$IP0" dev veth0 229 + ip netns exec "$ns1" ping -q -w 1 -c 1 "$DUMMYNET".2 > /dev/null 230 + 231 + if ip netns exec "$ns0" nft list counter t fibcount | grep -q "packets 1"; then 232 + echo "PASS: fib lookup returned exepected output interface" 233 + else 234 + echo "FAIL: fib lookup did not return exepected output interface" 235 + ret=1 236 + return 237 + fi 238 + } 239 + 222 240 test_ct_zone_in 223 241 test_masquerade_vrf "default" 224 242 test_masquerade_vrf "pfifo" 225 243 test_masquerade_veth 244 + test_fib 226 245 227 246 exit $ret
+121
tools/testing/selftests/net/netfilter/vxlan_mtu_frag.sh
··· 1 + #!/bin/bash 2 + # SPDX-License-Identifier: GPL-2.0 3 + 4 + source lib.sh 5 + 6 + if ! modprobe -q -n br_netfilter 2>&1; then 7 + echo "SKIP: Test needs br_netfilter kernel module" 8 + exit $ksft_skip 9 + fi 10 + 11 + cleanup() 12 + { 13 + cleanup_all_ns 14 + } 15 + 16 + trap cleanup EXIT 17 + 18 + setup_ns host vtep router 19 + 20 + create_topology() 21 + { 22 + ip link add host-eth0 netns "$host" type veth peer name vtep-host netns "$vtep" 23 + ip link add vtep-router netns "$vtep" type veth peer name router-vtep netns "$router" 24 + } 25 + 26 + setup_host() 27 + { 28 + # bring ports up 29 + ip -n "$host" addr add 10.0.0.1/24 dev host-eth0 30 + ip -n "$host" link set host-eth0 up 31 + 32 + # Add VLAN 10,20 33 + for vid in 10 20; do 34 + ip -n "$host" link add link host-eth0 name host-eth0.$vid type vlan id $vid 35 + ip -n "$host" addr add 10.0.$vid.1/24 dev host-eth0.$vid 36 + ip -n "$host" link set host-eth0.$vid up 37 + done 38 + } 39 + 40 + setup_vtep() 41 + { 42 + # create bridge on vtep 43 + ip -n "$vtep" link add name br0 type bridge 44 + ip -n "$vtep" link set br0 type bridge vlan_filtering 1 45 + 46 + # VLAN 10 is untagged PVID 47 + ip -n "$vtep" link set dev vtep-host master br0 48 + bridge -n "$vtep" vlan add dev vtep-host vid 10 pvid untagged 49 + 50 + # VLAN 20 as other VID 51 + ip -n "$vtep" link set dev vtep-host master br0 52 + bridge -n "$vtep" vlan add dev vtep-host vid 20 53 + 54 + # single-vxlan device on vtep 55 + ip -n "$vtep" address add dev vtep-router 60.0.0.1/24 56 + ip -n "$vtep" link add dev vxd type vxlan external \ 57 + vnifilter local 60.0.0.1 remote 60.0.0.2 dstport 4789 ttl 64 58 + ip -n "$vtep" link set vxd master br0 59 + 60 + # Add VLAN-VNI 1-1 mappings 61 + bridge -n "$vtep" link set dev vxd vlan_tunnel on 62 + for vid in 10 20; do 63 + bridge -n "$vtep" vlan add dev vxd vid $vid 64 + bridge -n "$vtep" vlan add dev vxd vid $vid tunnel_info id $vid 65 + bridge -n "$vtep" vni add dev vxd vni $vid 66 + done 67 + 68 + # bring ports up 69 + ip -n "$vtep" link set vxd up 70 + ip -n "$vtep" link set vtep-router up 71 + ip -n "$vtep" link set vtep-host up 72 + ip -n "$vtep" link set dev br0 up 73 + } 74 + 75 + setup_router() 76 + { 77 + # bring ports up 78 + ip -n "$router" link set router-vtep up 79 + } 80 + 81 + setup() 82 + { 83 + modprobe -q br_netfilter 84 + create_topology 85 + setup_host 86 + setup_vtep 87 + setup_router 88 + } 89 + 90 + test_large_mtu_untagged_traffic() 91 + { 92 + ip -n "$vtep" link set vxd mtu 1000 93 + ip -n "$host" neigh add 10.0.0.2 lladdr ca:fe:ba:be:00:01 dev host-eth0 94 + ip netns exec "$host" \ 95 + ping -q 10.0.0.2 -I host-eth0 -c 1 -W 0.5 -s2000 > /dev/null 2>&1 96 + return 0 97 + } 98 + 99 + test_large_mtu_tagged_traffic() 100 + { 101 + for vid in 10 20; do 102 + ip -n "$vtep" link set vxd mtu 1000 103 + ip -n "$host" neigh add 10.0.$vid.2 lladdr ca:fe:ba:be:00:01 dev host-eth0.$vid 104 + ip netns exec "$host" \ 105 + ping -q 10.0.$vid.2 -I host-eth0.$vid -c 1 -W 0.5 -s2000 > /dev/null 2>&1 106 + done 107 + return 0 108 + } 109 + 110 + do_test() 111 + { 112 + # Frames will be dropped so ping will not succeed 113 + # If it doesn't panic, it passes 114 + test_large_mtu_tagged_traffic 115 + test_large_mtu_untagged_traffic 116 + } 117 + 118 + setup && \ 119 + echo "Test for VxLAN fragmentation with large MTU in br_netfilter:" && \ 120 + do_test && echo "PASS!" 121 + exit $?
+1
tools/testing/selftests/net/rds/.gitignore
··· 1 + include.sh
+1 -1
tools/testing/selftests/net/rds/Makefile
··· 8 8 9 9 TEST_FILES := include.sh 10 10 11 - EXTRA_CLEAN := /tmp/rds_logs 11 + EXTRA_CLEAN := /tmp/rds_logs include.sh 12 12 13 13 include ../../lib.mk
+4
tools/testing/selftests/net/ynl.mk
··· 19 19 $(OUTPUT)/libynl.a: 20 20 $(Q)$(MAKE) -C $(top_srcdir)/tools/net/ynl GENS="$(YNL_GENS)" libynl.a 21 21 $(Q)cp $(top_srcdir)/tools/net/ynl/libynl.a $(OUTPUT)/libynl.a 22 + 23 + EXTRA_CLEAN += \ 24 + $(top_srcdir)/tools/net/ynl/lib/__pycache__ \ 25 + $(top_srcdir)/tools/net/ynl/lib/*.[ado]