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

Configure Feed

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

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

Pull networking fixes from David Miller:

1) Various netfilter fixlets from Pablo and the netfilter team.

2) Fix regression in IPVS caused by lack of PMTU exceptions on local
routes in ipv6, from Julian Anastasov.

3) Check pskb_trim_rcsum for failure in DSA, from Zhouyang Jia.

4) Don't crash on poll in TLS, from Daniel Borkmann.

5) Revert SO_REUSE{ADDR,PORT} change, it regresses various things
including Avahi mDNS. From Bart Van Assche.

6) Missing of_node_put in qcom/emac driver, from Yue Haibing.

7) We lack checking of the TCP checking in one special case during SYN
receive, from Frank van der Linden.

8) Fix module init error paths of mac80211 hwsim, from Johannes Berg.

9) Handle 802.1ad properly in stmmac driver, from Elad Nachman.

10) Must grab HW caps before doing quirk checks in stmmac driver, from
Jose Abreu.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (81 commits)
net: stmmac: Run HWIF Quirks after getting HW caps
neighbour: skip NTF_EXT_LEARNED entries during forced gc
net: cxgb3: add error handling for sysfs_create_group
tls: fix waitall behavior in tls_sw_recvmsg
tls: fix use-after-free in tls_push_record
l2tp: filter out non-PPP sessions in pppol2tp_tunnel_ioctl()
l2tp: reject creation of non-PPP sessions on L2TPv2 tunnels
mlxsw: spectrum_switchdev: Fix port_vlan refcounting
mlxsw: spectrum_router: Align with new route replace logic
mlxsw: spectrum_router: Allow appending to dev-only routes
ipv6: Only emit append events for appended routes
stmmac: added support for 802.1ad vlan stripping
cfg80211: fix rcu in cfg80211_unregister_wdev
mac80211: Move up init of TXQs
mac80211_hwsim: fix module init error paths
cfg80211: initialize sinfo in cfg80211_get_station
nl80211: fix some kernel doc tag mistakes
hv_netvsc: Fix the variable sizes in ipsecv2 and rsc offload
rds: avoid unenecessary cong_update in loop transport
l2tp: clean up stale tunnel or session in pppol2tp_connect's error path
...

+681 -343
+2
drivers/net/ethernet/cavium/thunder/nic.h
··· 325 325 struct tasklet_struct qs_err_task; 326 326 struct work_struct reset_task; 327 327 struct nicvf_work rx_mode_work; 328 + /* spinlock to protect workqueue arguments from concurrent access */ 329 + spinlock_t rx_mode_wq_lock; 328 330 329 331 /* PTP timestamp */ 330 332 struct cavium_ptp *ptp_clock;
+36 -14
drivers/net/ethernet/cavium/thunder/nicvf_main.c
··· 1923 1923 } 1924 1924 } 1925 1925 1926 - static void nicvf_set_rx_mode_task(struct work_struct *work_arg) 1926 + static void __nicvf_set_rx_mode_task(u8 mode, struct xcast_addr_list *mc_addrs, 1927 + struct nicvf *nic) 1927 1928 { 1928 - struct nicvf_work *vf_work = container_of(work_arg, struct nicvf_work, 1929 - work.work); 1930 - struct nicvf *nic = container_of(vf_work, struct nicvf, rx_mode_work); 1931 1929 union nic_mbx mbx = {}; 1932 1930 int idx; 1933 - 1934 - if (!vf_work) 1935 - return; 1936 1931 1937 1932 /* From the inside of VM code flow we have only 128 bits memory 1938 1933 * available to send message to host's PF, so send all mc addrs ··· 1939 1944 mbx.xcast.msg = NIC_MBOX_MSG_RESET_XCAST; 1940 1945 nicvf_send_msg_to_pf(nic, &mbx); 1941 1946 1942 - if (vf_work->mode & BGX_XCAST_MCAST_FILTER) { 1947 + if (mode & BGX_XCAST_MCAST_FILTER) { 1943 1948 /* once enabling filtering, we need to signal to PF to add 1944 1949 * its' own LMAC to the filter to accept packets for it. 1945 1950 */ ··· 1949 1954 } 1950 1955 1951 1956 /* check if we have any specific MACs to be added to PF DMAC filter */ 1952 - if (vf_work->mc) { 1957 + if (mc_addrs) { 1953 1958 /* now go through kernel list of MACs and add them one by one */ 1954 - for (idx = 0; idx < vf_work->mc->count; idx++) { 1959 + for (idx = 0; idx < mc_addrs->count; idx++) { 1955 1960 mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST; 1956 - mbx.xcast.data.mac = vf_work->mc->mc[idx]; 1961 + mbx.xcast.data.mac = mc_addrs->mc[idx]; 1957 1962 nicvf_send_msg_to_pf(nic, &mbx); 1958 1963 } 1959 - kfree(vf_work->mc); 1964 + kfree(mc_addrs); 1960 1965 } 1961 1966 1962 1967 /* and finally set rx mode for PF accordingly */ 1963 1968 mbx.xcast.msg = NIC_MBOX_MSG_SET_XCAST; 1964 - mbx.xcast.data.mode = vf_work->mode; 1969 + mbx.xcast.data.mode = mode; 1965 1970 1966 1971 nicvf_send_msg_to_pf(nic, &mbx); 1972 + } 1973 + 1974 + static void nicvf_set_rx_mode_task(struct work_struct *work_arg) 1975 + { 1976 + struct nicvf_work *vf_work = container_of(work_arg, struct nicvf_work, 1977 + work.work); 1978 + struct nicvf *nic = container_of(vf_work, struct nicvf, rx_mode_work); 1979 + u8 mode; 1980 + struct xcast_addr_list *mc; 1981 + 1982 + if (!vf_work) 1983 + return; 1984 + 1985 + /* Save message data locally to prevent them from 1986 + * being overwritten by next ndo_set_rx_mode call(). 1987 + */ 1988 + spin_lock(&nic->rx_mode_wq_lock); 1989 + mode = vf_work->mode; 1990 + mc = vf_work->mc; 1991 + vf_work->mc = NULL; 1992 + spin_unlock(&nic->rx_mode_wq_lock); 1993 + 1994 + __nicvf_set_rx_mode_task(mode, mc, nic); 1967 1995 } 1968 1996 1969 1997 static void nicvf_set_rx_mode(struct net_device *netdev) ··· 2022 2004 } 2023 2005 } 2024 2006 } 2007 + spin_lock(&nic->rx_mode_wq_lock); 2008 + kfree(nic->rx_mode_work.mc); 2025 2009 nic->rx_mode_work.mc = mc_list; 2026 2010 nic->rx_mode_work.mode = mode; 2027 - queue_delayed_work(nicvf_rx_mode_wq, &nic->rx_mode_work.work, 2 * HZ); 2011 + queue_delayed_work(nicvf_rx_mode_wq, &nic->rx_mode_work.work, 0); 2012 + spin_unlock(&nic->rx_mode_wq_lock); 2028 2013 } 2029 2014 2030 2015 static const struct net_device_ops nicvf_netdev_ops = { ··· 2184 2163 INIT_WORK(&nic->reset_task, nicvf_reset_task); 2185 2164 2186 2165 INIT_DELAYED_WORK(&nic->rx_mode_work.work, nicvf_set_rx_mode_task); 2166 + spin_lock_init(&nic->rx_mode_wq_lock); 2187 2167 2188 2168 err = register_netdev(netdev); 2189 2169 if (err) {
+7
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
··· 3362 3362 3363 3363 err = sysfs_create_group(&adapter->port[0]->dev.kobj, 3364 3364 &cxgb3_attr_group); 3365 + if (err) { 3366 + dev_err(&pdev->dev, "cannot create sysfs group\n"); 3367 + goto out_close_led; 3368 + } 3365 3369 3366 3370 print_port_info(adapter, ai); 3367 3371 return 0; 3372 + 3373 + out_close_led: 3374 + t3_set_reg_field(adapter, A_T3DBG_GPIO_EN, F_GPIO0_OUT_VAL, 0); 3368 3375 3369 3376 out_free_dev: 3370 3377 iounmap(adapter->regs);
+2 -2
drivers/net/ethernet/intel/ixgbe/ixgbe.h
··· 760 760 #define IXGBE_RSS_KEY_SIZE 40 /* size of RSS Hash Key in bytes */ 761 761 u32 *rss_key; 762 762 763 - #ifdef CONFIG_XFRM 763 + #ifdef CONFIG_XFRM_OFFLOAD 764 764 struct ixgbe_ipsec *ipsec; 765 - #endif /* CONFIG_XFRM */ 765 + #endif /* CONFIG_XFRM_OFFLOAD */ 766 766 }; 767 767 768 768 static inline u8 ixgbe_max_rss_indices(struct ixgbe_adapter *adapter)
+24 -10
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
··· 158 158 reg |= IXGBE_SECRXCTRL_RX_DIS; 159 159 IXGBE_WRITE_REG(hw, IXGBE_SECRXCTRL, reg); 160 160 161 - IXGBE_WRITE_FLUSH(hw); 161 + /* If both Tx and Rx are ready there are no packets 162 + * that we need to flush so the loopback configuration 163 + * below is not necessary. 164 + */ 165 + t_rdy = IXGBE_READ_REG(hw, IXGBE_SECTXSTAT) & 166 + IXGBE_SECTXSTAT_SECTX_RDY; 167 + r_rdy = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT) & 168 + IXGBE_SECRXSTAT_SECRX_RDY; 169 + if (t_rdy && r_rdy) 170 + return; 162 171 163 172 /* If the tx fifo doesn't have link, but still has data, 164 173 * we can't clear the tx sec block. Set the MAC loopback ··· 194 185 IXGBE_SECTXSTAT_SECTX_RDY; 195 186 r_rdy = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT) & 196 187 IXGBE_SECRXSTAT_SECRX_RDY; 197 - } while (!t_rdy && !r_rdy && limit--); 188 + } while (!(t_rdy && r_rdy) && limit--); 198 189 199 190 /* undo loopback if we played with it earlier */ 200 191 if (!link) { ··· 975 966 **/ 976 967 void ixgbe_init_ipsec_offload(struct ixgbe_adapter *adapter) 977 968 { 969 + struct ixgbe_hw *hw = &adapter->hw; 978 970 struct ixgbe_ipsec *ipsec; 971 + u32 t_dis, r_dis; 979 972 size_t size; 980 973 981 - if (adapter->hw.mac.type == ixgbe_mac_82598EB) 974 + if (hw->mac.type == ixgbe_mac_82598EB) 975 + return; 976 + 977 + /* If there is no support for either Tx or Rx offload 978 + * we should not be advertising support for IPsec. 979 + */ 980 + t_dis = IXGBE_READ_REG(hw, IXGBE_SECTXSTAT) & 981 + IXGBE_SECTXSTAT_SECTX_OFF_DIS; 982 + r_dis = IXGBE_READ_REG(hw, IXGBE_SECRXSTAT) & 983 + IXGBE_SECRXSTAT_SECRX_OFF_DIS; 984 + if (t_dis || r_dis) 982 985 return; 983 986 984 987 ipsec = kzalloc(sizeof(*ipsec), GFP_KERNEL); ··· 1021 1000 ixgbe_ipsec_clear_hw_tables(adapter); 1022 1001 1023 1002 adapter->netdev->xfrmdev_ops = &ixgbe_xfrmdev_ops; 1024 - 1025 - #define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \ 1026 - NETIF_F_HW_ESP_TX_CSUM | \ 1027 - NETIF_F_GSO_ESP) 1028 - 1029 - adapter->netdev->features |= IXGBE_ESP_FEATURES; 1030 - adapter->netdev->hw_enc_features |= IXGBE_ESP_FEATURES; 1031 1003 1032 1004 return; 1033 1005
+8
drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
··· 593 593 } 594 594 595 595 #endif 596 + /* To support macvlan offload we have to use num_tc to 597 + * restrict the queues that can be used by the device. 598 + * By doing this we can avoid reporting a false number of 599 + * queues. 600 + */ 601 + if (vmdq_i > 1) 602 + netdev_set_num_tc(adapter->netdev, 1); 603 + 596 604 /* populate TC0 for use by pool 0 */ 597 605 netdev_set_tc_queue(adapter->netdev, 0, 598 606 adapter->num_rx_queues_per_pool, 0);
+10 -11
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 6117 6117 #ifdef CONFIG_IXGBE_DCB 6118 6118 ixgbe_init_dcb(adapter); 6119 6119 #endif 6120 + ixgbe_init_ipsec_offload(adapter); 6120 6121 6121 6122 /* default flow control settings */ 6122 6123 hw->fc.requested_mode = ixgbe_fc_full; ··· 8823 8822 } else { 8824 8823 netdev_reset_tc(dev); 8825 8824 8826 - /* To support macvlan offload we have to use num_tc to 8827 - * restrict the queues that can be used by the device. 8828 - * By doing this we can avoid reporting a false number of 8829 - * queues. 8830 - */ 8831 - if (!tc && adapter->num_rx_pools > 1) 8832 - netdev_set_num_tc(dev, 1); 8833 - 8834 8825 if (adapter->hw.mac.type == ixgbe_mac_82598EB) 8835 8826 adapter->hw.fc.requested_mode = adapter->last_lfc_mode; 8836 8827 ··· 9897 9904 * the TSO, so it's the exception. 9898 9905 */ 9899 9906 if (skb->encapsulation && !(features & NETIF_F_TSO_MANGLEID)) { 9900 - #ifdef CONFIG_XFRM 9907 + #ifdef CONFIG_XFRM_OFFLOAD 9901 9908 if (!skb->sp) 9902 9909 #endif 9903 9910 features &= ~NETIF_F_TSO; ··· 10430 10437 if (hw->mac.type >= ixgbe_mac_82599EB) 10431 10438 netdev->features |= NETIF_F_SCTP_CRC; 10432 10439 10440 + #ifdef CONFIG_XFRM_OFFLOAD 10441 + #define IXGBE_ESP_FEATURES (NETIF_F_HW_ESP | \ 10442 + NETIF_F_HW_ESP_TX_CSUM | \ 10443 + NETIF_F_GSO_ESP) 10444 + 10445 + if (adapter->ipsec) 10446 + netdev->features |= IXGBE_ESP_FEATURES; 10447 + #endif 10433 10448 /* copy netdev features into list of user selectable features */ 10434 10449 netdev->hw_features |= netdev->features | 10435 10450 NETIF_F_HW_VLAN_CTAG_FILTER | ··· 10500 10499 NETIF_F_FCOE_MTU; 10501 10500 } 10502 10501 #endif /* IXGBE_FCOE */ 10503 - ixgbe_init_ipsec_offload(adapter); 10504 - 10505 10502 if (adapter->flags2 & IXGBE_FLAG2_RSC_CAPABLE) 10506 10503 netdev->hw_features |= NETIF_F_LRO; 10507 10504 if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
+4 -2
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
··· 599 599 #define IXGBE_SECTXCTRL_STORE_FORWARD 0x00000004 600 600 601 601 #define IXGBE_SECTXSTAT_SECTX_RDY 0x00000001 602 - #define IXGBE_SECTXSTAT_ECC_TXERR 0x00000002 602 + #define IXGBE_SECTXSTAT_SECTX_OFF_DIS 0x00000002 603 + #define IXGBE_SECTXSTAT_ECC_TXERR 0x00000004 603 604 604 605 #define IXGBE_SECRXCTRL_SECRX_DIS 0x00000001 605 606 #define IXGBE_SECRXCTRL_RX_DIS 0x00000002 606 607 607 608 #define IXGBE_SECRXSTAT_SECRX_RDY 0x00000001 608 - #define IXGBE_SECRXSTAT_ECC_RXERR 0x00000002 609 + #define IXGBE_SECRXSTAT_SECRX_OFF_DIS 0x00000002 610 + #define IXGBE_SECRXSTAT_ECC_RXERR 0x00000004 609 611 610 612 /* LinkSec (MacSec) Registers */ 611 613 #define IXGBE_LSECTXCAP 0x08A00
+24 -24
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
··· 4756 4756 kfree(mlxsw_sp_rt6); 4757 4757 } 4758 4758 4759 - static bool mlxsw_sp_fib6_rt_can_mp(const struct fib6_info *rt) 4760 - { 4761 - /* RTF_CACHE routes are ignored */ 4762 - return (rt->fib6_flags & (RTF_GATEWAY | RTF_ADDRCONF)) == RTF_GATEWAY; 4763 - } 4764 - 4765 4759 static struct fib6_info * 4766 4760 mlxsw_sp_fib6_entry_rt(const struct mlxsw_sp_fib6_entry *fib6_entry) 4767 4761 { ··· 4765 4771 4766 4772 static struct mlxsw_sp_fib6_entry * 4767 4773 mlxsw_sp_fib6_node_mp_entry_find(const struct mlxsw_sp_fib_node *fib_node, 4768 - const struct fib6_info *nrt, bool replace) 4774 + const struct fib6_info *nrt, bool append) 4769 4775 { 4770 4776 struct mlxsw_sp_fib6_entry *fib6_entry; 4771 4777 4772 - if (!mlxsw_sp_fib6_rt_can_mp(nrt) || replace) 4778 + if (!append) 4773 4779 return NULL; 4774 4780 4775 4781 list_for_each_entry(fib6_entry, &fib_node->entry_list, common.list) { ··· 4784 4790 break; 4785 4791 if (rt->fib6_metric < nrt->fib6_metric) 4786 4792 continue; 4787 - if (rt->fib6_metric == nrt->fib6_metric && 4788 - mlxsw_sp_fib6_rt_can_mp(rt)) 4793 + if (rt->fib6_metric == nrt->fib6_metric) 4789 4794 return fib6_entry; 4790 4795 if (rt->fib6_metric > nrt->fib6_metric) 4791 4796 break; ··· 5163 5170 mlxsw_sp_fib6_node_entry_find(const struct mlxsw_sp_fib_node *fib_node, 5164 5171 const struct fib6_info *nrt, bool replace) 5165 5172 { 5166 - struct mlxsw_sp_fib6_entry *fib6_entry, *fallback = NULL; 5173 + struct mlxsw_sp_fib6_entry *fib6_entry; 5167 5174 5168 5175 list_for_each_entry(fib6_entry, &fib_node->entry_list, common.list) { 5169 5176 struct fib6_info *rt = mlxsw_sp_fib6_entry_rt(fib6_entry); ··· 5172 5179 continue; 5173 5180 if (rt->fib6_table->tb6_id != nrt->fib6_table->tb6_id) 5174 5181 break; 5175 - if (replace && rt->fib6_metric == nrt->fib6_metric) { 5176 - if (mlxsw_sp_fib6_rt_can_mp(rt) == 5177 - mlxsw_sp_fib6_rt_can_mp(nrt)) 5178 - return fib6_entry; 5179 - if (mlxsw_sp_fib6_rt_can_mp(nrt)) 5180 - fallback = fallback ?: fib6_entry; 5181 - } 5182 + if (replace && rt->fib6_metric == nrt->fib6_metric) 5183 + return fib6_entry; 5182 5184 if (rt->fib6_metric > nrt->fib6_metric) 5183 - return fallback ?: fib6_entry; 5185 + return fib6_entry; 5184 5186 } 5185 5187 5186 - return fallback; 5188 + return NULL; 5187 5189 } 5188 5190 5189 5191 static int ··· 5304 5316 } 5305 5317 5306 5318 static int mlxsw_sp_router_fib6_add(struct mlxsw_sp *mlxsw_sp, 5307 - struct fib6_info *rt, bool replace) 5319 + struct fib6_info *rt, bool replace, 5320 + bool append) 5308 5321 { 5309 5322 struct mlxsw_sp_fib6_entry *fib6_entry; 5310 5323 struct mlxsw_sp_fib_node *fib_node; ··· 5331 5342 /* Before creating a new entry, try to append route to an existing 5332 5343 * multipath entry. 5333 5344 */ 5334 - fib6_entry = mlxsw_sp_fib6_node_mp_entry_find(fib_node, rt, replace); 5345 + fib6_entry = mlxsw_sp_fib6_node_mp_entry_find(fib_node, rt, append); 5335 5346 if (fib6_entry) { 5336 5347 err = mlxsw_sp_fib6_entry_nexthop_add(mlxsw_sp, fib6_entry, rt); 5337 5348 if (err) 5338 5349 goto err_fib6_entry_nexthop_add; 5339 5350 return 0; 5351 + } 5352 + 5353 + /* We received an append event, yet did not find any route to 5354 + * append to. 5355 + */ 5356 + if (WARN_ON(append)) { 5357 + err = -EINVAL; 5358 + goto err_fib6_entry_append; 5340 5359 } 5341 5360 5342 5361 fib6_entry = mlxsw_sp_fib6_entry_create(mlxsw_sp, fib_node, rt); ··· 5364 5367 err_fib6_node_entry_link: 5365 5368 mlxsw_sp_fib6_entry_destroy(mlxsw_sp, fib6_entry); 5366 5369 err_fib6_entry_create: 5370 + err_fib6_entry_append: 5367 5371 err_fib6_entry_nexthop_add: 5368 5372 mlxsw_sp_fib_node_put(mlxsw_sp, fib_node); 5369 5373 return err; ··· 5715 5717 struct mlxsw_sp_fib_event_work *fib_work = 5716 5718 container_of(work, struct mlxsw_sp_fib_event_work, work); 5717 5719 struct mlxsw_sp *mlxsw_sp = fib_work->mlxsw_sp; 5718 - bool replace; 5720 + bool replace, append; 5719 5721 int err; 5720 5722 5721 5723 rtnl_lock(); ··· 5726 5728 case FIB_EVENT_ENTRY_APPEND: /* fall through */ 5727 5729 case FIB_EVENT_ENTRY_ADD: 5728 5730 replace = fib_work->event == FIB_EVENT_ENTRY_REPLACE; 5731 + append = fib_work->event == FIB_EVENT_ENTRY_APPEND; 5729 5732 err = mlxsw_sp_router_fib6_add(mlxsw_sp, 5730 - fib_work->fen6_info.rt, replace); 5733 + fib_work->fen6_info.rt, replace, 5734 + append); 5731 5735 if (err) 5732 5736 mlxsw_sp_router_fib_abort(mlxsw_sp); 5733 5737 mlxsw_sp_rt6_release(fib_work->fen6_info.rt);
+3 -1
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
··· 1018 1018 int err; 1019 1019 1020 1020 /* No need to continue if only VLAN flags were changed */ 1021 - if (mlxsw_sp_port_vlan->bridge_port) 1021 + if (mlxsw_sp_port_vlan->bridge_port) { 1022 + mlxsw_sp_port_vlan_put(mlxsw_sp_port_vlan); 1022 1023 return 0; 1024 + } 1023 1025 1024 1026 err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port); 1025 1027 if (err)
+1
drivers/net/ethernet/netronome/nfp/flower/main.c
··· 455 455 456 456 eth_hw_addr_random(nn->dp.netdev); 457 457 netif_keep_dst(nn->dp.netdev); 458 + nn->vnic_no_name = true; 458 459 459 460 return 0; 460 461
+2
drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c
··· 381 381 err = PTR_ERR_OR_ZERO(rt); 382 382 if (err) 383 383 return NOTIFY_DONE; 384 + 385 + ip_rt_put(rt); 384 386 #else 385 387 return NOTIFY_DONE; 386 388 #endif
+4
drivers/net/ethernet/netronome/nfp/nfp_net.h
··· 590 590 * @vnic_list: Entry on device vNIC list 591 591 * @pdev: Backpointer to PCI device 592 592 * @app: APP handle if available 593 + * @vnic_no_name: For non-port PF vNIC make ndo_get_phys_port_name return 594 + * -EOPNOTSUPP to keep backwards compatibility (set by app) 593 595 * @port: Pointer to nfp_port structure if vNIC is a port 594 596 * @app_priv: APP private data for this vNIC 595 597 */ ··· 664 662 665 663 struct pci_dev *pdev; 666 664 struct nfp_app *app; 665 + 666 + bool vnic_no_name; 667 667 668 668 struct nfp_port *port; 669 669
+2 -2
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
··· 3121 3121 struct nfp_net *nn = netdev_priv(netdev); 3122 3122 int r; 3123 3123 3124 - for (r = 0; r < nn->dp.num_r_vecs; r++) { 3124 + for (r = 0; r < nn->max_r_vecs; r++) { 3125 3125 struct nfp_net_r_vector *r_vec = &nn->r_vecs[r]; 3126 3126 u64 data[3]; 3127 3127 unsigned int start; ··· 3286 3286 if (nn->port) 3287 3287 return nfp_port_get_phys_port_name(netdev, name, len); 3288 3288 3289 - if (nn->dp.is_vf) 3289 + if (nn->dp.is_vf || nn->vnic_no_name) 3290 3290 return -EOPNOTSUPP; 3291 3291 3292 3292 n = snprintf(name, len, "n%d", nn->id);
+2 -5
drivers/net/ethernet/netronome/nfp/nfpcore/nfp_resource.c
··· 98 98 99 99 static int nfp_cpp_resource_find(struct nfp_cpp *cpp, struct nfp_resource *res) 100 100 { 101 - char name_pad[NFP_RESOURCE_ENTRY_NAME_SZ] = {}; 102 101 struct nfp_resource_entry entry; 103 102 u32 cpp_id, key; 104 103 int ret, i; 105 104 106 105 cpp_id = NFP_CPP_ID(NFP_RESOURCE_TBL_TARGET, 3, 0); /* Atomic read */ 107 106 108 - strncpy(name_pad, res->name, sizeof(name_pad)); 109 - 110 107 /* Search for a matching entry */ 111 - if (!memcmp(name_pad, NFP_RESOURCE_TBL_NAME "\0\0\0\0\0\0\0\0", 8)) { 108 + if (!strcmp(res->name, NFP_RESOURCE_TBL_NAME)) { 112 109 nfp_err(cpp, "Grabbing device lock not supported\n"); 113 110 return -EOPNOTSUPP; 114 111 } 115 - key = crc32_posix(name_pad, sizeof(name_pad)); 112 + key = crc32_posix(res->name, NFP_RESOURCE_ENTRY_NAME_SZ); 116 113 117 114 for (i = 0; i < NFP_RESOURCE_TBL_ENTRIES; i++) { 118 115 u64 addr = NFP_RESOURCE_TBL_BASE +
+1
drivers/net/ethernet/qualcomm/emac/emac-sgmii.c
··· 384 384 } 385 385 386 386 sgmii_pdev = of_find_device_by_node(np); 387 + of_node_put(np); 387 388 if (!sgmii_pdev) { 388 389 dev_err(&pdev->dev, "invalid internal-phy property\n"); 389 390 return -ENODEV;
+4 -3
drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c
··· 334 334 335 335 dwmac->data = (const struct meson8b_dwmac_data *) 336 336 of_device_get_match_data(&pdev->dev); 337 - if (!dwmac->data) 338 - return -EINVAL; 339 - 337 + if (!dwmac->data) { 338 + ret = -EINVAL; 339 + goto err_remove_config_dt; 340 + } 340 341 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 341 342 dwmac->regs = devm_ioremap_resource(&pdev->dev, res); 342 343 if (IS_ERR(dwmac->regs)) {
+2 -7
drivers/net/ethernet/stmicro/stmmac/hwif.c
··· 252 252 return ret; 253 253 } 254 254 255 - /* Run quirks, if needed */ 256 - if (entry->quirks) { 257 - ret = entry->quirks(priv); 258 - if (ret) 259 - return ret; 260 - } 261 - 255 + /* Save quirks, if needed for posterior use */ 256 + priv->hwif_quirks = entry->quirks; 262 257 return 0; 263 258 } 264 259
+1
drivers/net/ethernet/stmicro/stmmac/stmmac.h
··· 129 129 struct net_device *dev; 130 130 struct device *device; 131 131 struct mac_device_info *hw; 132 + int (*hwif_quirks)(struct stmmac_priv *priv); 132 133 struct mutex lock; 133 134 134 135 /* RX Queue */
+20 -8
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
··· 3182 3182 3183 3183 static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb) 3184 3184 { 3185 - struct ethhdr *ehdr; 3185 + struct vlan_ethhdr *veth; 3186 + __be16 vlan_proto; 3186 3187 u16 vlanid; 3187 3188 3188 - if ((dev->features & NETIF_F_HW_VLAN_CTAG_RX) == 3189 - NETIF_F_HW_VLAN_CTAG_RX && 3190 - !__vlan_get_tag(skb, &vlanid)) { 3189 + veth = (struct vlan_ethhdr *)skb->data; 3190 + vlan_proto = veth->h_vlan_proto; 3191 + 3192 + if ((vlan_proto == htons(ETH_P_8021Q) && 3193 + dev->features & NETIF_F_HW_VLAN_CTAG_RX) || 3194 + (vlan_proto == htons(ETH_P_8021AD) && 3195 + dev->features & NETIF_F_HW_VLAN_STAG_RX)) { 3191 3196 /* pop the vlan tag */ 3192 - ehdr = (struct ethhdr *)skb->data; 3193 - memmove(skb->data + VLAN_HLEN, ehdr, ETH_ALEN * 2); 3197 + vlanid = ntohs(veth->h_vlan_TCI); 3198 + memmove(skb->data + VLAN_HLEN, veth, ETH_ALEN * 2); 3194 3199 skb_pull(skb, VLAN_HLEN); 3195 - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlanid); 3200 + __vlan_hwaccel_put_tag(skb, vlan_proto, vlanid); 3196 3201 } 3197 3202 } 3198 3203 ··· 4135 4130 if (priv->dma_cap.tsoen) 4136 4131 dev_info(priv->device, "TSO supported\n"); 4137 4132 4133 + /* Run HW quirks, if any */ 4134 + if (priv->hwif_quirks) { 4135 + ret = priv->hwif_quirks(priv); 4136 + if (ret) 4137 + return ret; 4138 + } 4139 + 4138 4140 return 0; 4139 4141 } 4140 4142 ··· 4247 4235 ndev->watchdog_timeo = msecs_to_jiffies(watchdog); 4248 4236 #ifdef STMMAC_VLAN_TAG_USED 4249 4237 /* Both mac100 and gmac support receive VLAN tag detection */ 4250 - ndev->features |= NETIF_F_HW_VLAN_CTAG_RX; 4238 + ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; 4251 4239 #endif 4252 4240 priv->msg_enable = netif_msg_init(debug, default_msg_level); 4253 4241
+4 -8
drivers/net/ethernet/xilinx/xilinx_emaclite.c
··· 123 123 * @phy_node: pointer to the PHY device node 124 124 * @mii_bus: pointer to the MII bus 125 125 * @last_link: last link status 126 - * @has_mdio: indicates whether MDIO is included in the HW 127 126 */ 128 127 struct net_local { 129 128 ··· 143 144 struct mii_bus *mii_bus; 144 145 145 146 int last_link; 146 - bool has_mdio; 147 147 }; 148 148 149 149 ··· 861 863 bus->write = xemaclite_mdio_write; 862 864 bus->parent = dev; 863 865 864 - lp->mii_bus = bus; 865 - 866 866 rc = of_mdiobus_register(bus, np); 867 867 if (rc) { 868 868 dev_err(dev, "Failed to register mdio bus.\n"); 869 869 goto err_register; 870 870 } 871 + 872 + lp->mii_bus = bus; 871 873 872 874 return 0; 873 875 ··· 1143 1145 xemaclite_update_address(lp, ndev->dev_addr); 1144 1146 1145 1147 lp->phy_node = of_parse_phandle(ofdev->dev.of_node, "phy-handle", 0); 1146 - rc = xemaclite_mdio_setup(lp, &ofdev->dev); 1147 - if (rc) 1148 - dev_warn(&ofdev->dev, "error registering MDIO bus\n"); 1148 + xemaclite_mdio_setup(lp, &ofdev->dev); 1149 1149 1150 1150 dev_info(dev, "MAC address is now %pM\n", ndev->dev_addr); 1151 1151 ··· 1187 1191 struct net_local *lp = netdev_priv(ndev); 1188 1192 1189 1193 /* Un-register the mii_bus, if configured */ 1190 - if (lp->has_mdio) { 1194 + if (lp->mii_bus) { 1191 1195 mdiobus_unregister(lp->mii_bus); 1192 1196 mdiobus_free(lp->mii_bus); 1193 1197 lp->mii_bus = NULL;
-1
drivers/net/hyperv/Kconfig
··· 2 2 tristate "Microsoft Hyper-V virtual network driver" 3 3 depends on HYPERV 4 4 select UCS2_STRING 5 - select FAILOVER 6 5 help 7 6 Select this option to enable the Hyper-V virtual network driver.
+15 -15
drivers/net/hyperv/hyperv_net.h
··· 901 901 struct hv_device *device_ctx; 902 902 /* netvsc_device */ 903 903 struct netvsc_device __rcu *nvdev; 904 + /* list of netvsc net_devices */ 905 + struct list_head list; 904 906 /* reconfigure work */ 905 907 struct delayed_work dwork; 906 908 /* last reconfig time */ ··· 933 931 u32 vf_alloc; 934 932 /* Serial number of the VF to team with */ 935 933 u32 vf_serial; 936 - 937 - struct failover *failover; 938 934 }; 939 935 940 936 /* Per channel data */ ··· 1277 1277 1278 1278 struct ndis_ipsecv2_offload { 1279 1279 u32 encap; 1280 - u16 ip6; 1281 - u16 ip4opt; 1282 - u16 ip6ext; 1283 - u16 ah; 1284 - u16 esp; 1285 - u16 ah_esp; 1286 - u16 xport; 1287 - u16 tun; 1288 - u16 xport_tun; 1289 - u16 lso; 1290 - u16 extseq; 1280 + u8 ip6; 1281 + u8 ip4opt; 1282 + u8 ip6ext; 1283 + u8 ah; 1284 + u8 esp; 1285 + u8 ah_esp; 1286 + u8 xport; 1287 + u8 tun; 1288 + u8 xport_tun; 1289 + u8 lso; 1290 + u8 extseq; 1291 1291 u32 udp_esp; 1292 1292 u32 auth; 1293 1293 u32 crypto; ··· 1295 1295 }; 1296 1296 1297 1297 struct ndis_rsc_offload { 1298 - u16 ip4; 1299 - u16 ip6; 1298 + u8 ip4; 1299 + u8 ip6; 1300 1300 }; 1301 1301 1302 1302 struct ndis_encap_offload {
+182 -60
drivers/net/hyperv/netvsc_drv.c
··· 42 42 #include <net/pkt_sched.h> 43 43 #include <net/checksum.h> 44 44 #include <net/ip6_checksum.h> 45 - #include <net/failover.h> 46 45 47 46 #include "hyperv_net.h" 48 47 ··· 66 67 static int debug = -1; 67 68 module_param(debug, int, 0444); 68 69 MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)"); 70 + 71 + static LIST_HEAD(netvsc_dev_list); 69 72 70 73 static void netvsc_change_rx_flags(struct net_device *net, int change) 71 74 { ··· 1781 1780 rtnl_unlock(); 1782 1781 } 1783 1782 1783 + static struct net_device *get_netvsc_bymac(const u8 *mac) 1784 + { 1785 + struct net_device_context *ndev_ctx; 1786 + 1787 + list_for_each_entry(ndev_ctx, &netvsc_dev_list, list) { 1788 + struct net_device *dev = hv_get_drvdata(ndev_ctx->device_ctx); 1789 + 1790 + if (ether_addr_equal(mac, dev->perm_addr)) 1791 + return dev; 1792 + } 1793 + 1794 + return NULL; 1795 + } 1796 + 1797 + static struct net_device *get_netvsc_byref(struct net_device *vf_netdev) 1798 + { 1799 + struct net_device_context *net_device_ctx; 1800 + struct net_device *dev; 1801 + 1802 + dev = netdev_master_upper_dev_get(vf_netdev); 1803 + if (!dev || dev->netdev_ops != &device_ops) 1804 + return NULL; /* not a netvsc device */ 1805 + 1806 + net_device_ctx = netdev_priv(dev); 1807 + if (!rtnl_dereference(net_device_ctx->nvdev)) 1808 + return NULL; /* device is removed */ 1809 + 1810 + return dev; 1811 + } 1812 + 1784 1813 /* Called when VF is injecting data into network stack. 1785 1814 * Change the associated network device from VF to netvsc. 1786 1815 * note: already called with rcu_read_lock ··· 1831 1800 u64_stats_update_end(&pcpu_stats->syncp); 1832 1801 1833 1802 return RX_HANDLER_ANOTHER; 1803 + } 1804 + 1805 + static int netvsc_vf_join(struct net_device *vf_netdev, 1806 + struct net_device *ndev) 1807 + { 1808 + struct net_device_context *ndev_ctx = netdev_priv(ndev); 1809 + int ret; 1810 + 1811 + ret = netdev_rx_handler_register(vf_netdev, 1812 + netvsc_vf_handle_frame, ndev); 1813 + if (ret != 0) { 1814 + netdev_err(vf_netdev, 1815 + "can not register netvsc VF receive handler (err = %d)\n", 1816 + ret); 1817 + goto rx_handler_failed; 1818 + } 1819 + 1820 + ret = netdev_master_upper_dev_link(vf_netdev, ndev, 1821 + NULL, NULL, NULL); 1822 + if (ret != 0) { 1823 + netdev_err(vf_netdev, 1824 + "can not set master device %s (err = %d)\n", 1825 + ndev->name, ret); 1826 + goto upper_link_failed; 1827 + } 1828 + 1829 + /* set slave flag before open to prevent IPv6 addrconf */ 1830 + vf_netdev->flags |= IFF_SLAVE; 1831 + 1832 + schedule_delayed_work(&ndev_ctx->vf_takeover, VF_TAKEOVER_INT); 1833 + 1834 + call_netdevice_notifiers(NETDEV_JOIN, vf_netdev); 1835 + 1836 + netdev_info(vf_netdev, "joined to %s\n", ndev->name); 1837 + return 0; 1838 + 1839 + upper_link_failed: 1840 + netdev_rx_handler_unregister(vf_netdev); 1841 + rx_handler_failed: 1842 + return ret; 1834 1843 } 1835 1844 1836 1845 static void __netvsc_vf_setup(struct net_device *ndev, ··· 1923 1852 rtnl_unlock(); 1924 1853 } 1925 1854 1926 - static int netvsc_pre_register_vf(struct net_device *vf_netdev, 1927 - struct net_device *ndev) 1855 + static int netvsc_register_vf(struct net_device *vf_netdev) 1928 1856 { 1857 + struct net_device *ndev; 1929 1858 struct net_device_context *net_device_ctx; 1930 1859 struct netvsc_device *netvsc_dev; 1860 + int ret; 1861 + 1862 + if (vf_netdev->addr_len != ETH_ALEN) 1863 + return NOTIFY_DONE; 1864 + 1865 + /* 1866 + * We will use the MAC address to locate the synthetic interface to 1867 + * associate with the VF interface. If we don't find a matching 1868 + * synthetic interface, move on. 1869 + */ 1870 + ndev = get_netvsc_bymac(vf_netdev->perm_addr); 1871 + if (!ndev) 1872 + return NOTIFY_DONE; 1931 1873 1932 1874 net_device_ctx = netdev_priv(ndev); 1933 1875 netvsc_dev = rtnl_dereference(net_device_ctx->nvdev); 1934 1876 if (!netvsc_dev || rtnl_dereference(net_device_ctx->vf_netdev)) 1935 - return -ENODEV; 1877 + return NOTIFY_DONE; 1936 1878 1937 - return 0; 1938 - } 1879 + /* if syntihetic interface is a different namespace, 1880 + * then move the VF to that namespace; join will be 1881 + * done again in that context. 1882 + */ 1883 + if (!net_eq(dev_net(ndev), dev_net(vf_netdev))) { 1884 + ret = dev_change_net_namespace(vf_netdev, 1885 + dev_net(ndev), "eth%d"); 1886 + if (ret) 1887 + netdev_err(vf_netdev, 1888 + "could not move to same namespace as %s: %d\n", 1889 + ndev->name, ret); 1890 + else 1891 + netdev_info(vf_netdev, 1892 + "VF moved to namespace with: %s\n", 1893 + ndev->name); 1894 + return NOTIFY_DONE; 1895 + } 1939 1896 1940 - static int netvsc_register_vf(struct net_device *vf_netdev, 1941 - struct net_device *ndev) 1942 - { 1943 - struct net_device_context *ndev_ctx = netdev_priv(ndev); 1897 + netdev_info(ndev, "VF registering: %s\n", vf_netdev->name); 1944 1898 1945 - /* set slave flag before open to prevent IPv6 addrconf */ 1946 - vf_netdev->flags |= IFF_SLAVE; 1947 - 1948 - schedule_delayed_work(&ndev_ctx->vf_takeover, VF_TAKEOVER_INT); 1949 - 1950 - call_netdevice_notifiers(NETDEV_JOIN, vf_netdev); 1951 - 1952 - netdev_info(vf_netdev, "joined to %s\n", ndev->name); 1899 + if (netvsc_vf_join(vf_netdev, ndev) != 0) 1900 + return NOTIFY_DONE; 1953 1901 1954 1902 dev_hold(vf_netdev); 1955 - rcu_assign_pointer(ndev_ctx->vf_netdev, vf_netdev); 1956 - 1957 - return 0; 1903 + rcu_assign_pointer(net_device_ctx->vf_netdev, vf_netdev); 1904 + return NOTIFY_OK; 1958 1905 } 1959 1906 1960 1907 /* VF up/down change detected, schedule to change data path */ 1961 - static int netvsc_vf_changed(struct net_device *vf_netdev, 1962 - struct net_device *ndev) 1908 + static int netvsc_vf_changed(struct net_device *vf_netdev) 1963 1909 { 1964 1910 struct net_device_context *net_device_ctx; 1965 1911 struct netvsc_device *netvsc_dev; 1912 + struct net_device *ndev; 1966 1913 bool vf_is_up = netif_running(vf_netdev); 1914 + 1915 + ndev = get_netvsc_byref(vf_netdev); 1916 + if (!ndev) 1917 + return NOTIFY_DONE; 1967 1918 1968 1919 net_device_ctx = netdev_priv(ndev); 1969 1920 netvsc_dev = rtnl_dereference(net_device_ctx->nvdev); 1970 1921 if (!netvsc_dev) 1971 - return -ENODEV; 1922 + return NOTIFY_DONE; 1972 1923 1973 1924 netvsc_switch_datapath(ndev, vf_is_up); 1974 1925 netdev_info(ndev, "Data path switched %s VF: %s\n", 1975 1926 vf_is_up ? "to" : "from", vf_netdev->name); 1976 1927 1977 - return 0; 1928 + return NOTIFY_OK; 1978 1929 } 1979 1930 1980 - static int netvsc_pre_unregister_vf(struct net_device *vf_netdev, 1981 - struct net_device *ndev) 1931 + static int netvsc_unregister_vf(struct net_device *vf_netdev) 1982 1932 { 1933 + struct net_device *ndev; 1983 1934 struct net_device_context *net_device_ctx; 1935 + 1936 + ndev = get_netvsc_byref(vf_netdev); 1937 + if (!ndev) 1938 + return NOTIFY_DONE; 1984 1939 1985 1940 net_device_ctx = netdev_priv(ndev); 1986 1941 cancel_delayed_work_sync(&net_device_ctx->vf_takeover); 1987 1942 1988 - return 0; 1989 - } 1990 - 1991 - static int netvsc_unregister_vf(struct net_device *vf_netdev, 1992 - struct net_device *ndev) 1993 - { 1994 - struct net_device_context *net_device_ctx; 1995 - 1996 - net_device_ctx = netdev_priv(ndev); 1997 - 1998 1943 netdev_info(ndev, "VF unregistering: %s\n", vf_netdev->name); 1999 1944 1945 + netdev_rx_handler_unregister(vf_netdev); 1946 + netdev_upper_dev_unlink(vf_netdev, ndev); 2000 1947 RCU_INIT_POINTER(net_device_ctx->vf_netdev, NULL); 2001 1948 dev_put(vf_netdev); 2002 1949 2003 - return 0; 1950 + return NOTIFY_OK; 2004 1951 } 2005 - 2006 - static struct failover_ops netvsc_failover_ops = { 2007 - .slave_pre_register = netvsc_pre_register_vf, 2008 - .slave_register = netvsc_register_vf, 2009 - .slave_pre_unregister = netvsc_pre_unregister_vf, 2010 - .slave_unregister = netvsc_unregister_vf, 2011 - .slave_link_change = netvsc_vf_changed, 2012 - .slave_handle_frame = netvsc_vf_handle_frame, 2013 - }; 2014 1952 2015 1953 static int netvsc_probe(struct hv_device *dev, 2016 1954 const struct hv_vmbus_device_id *dev_id) ··· 2104 2024 else 2105 2025 net->max_mtu = ETH_DATA_LEN; 2106 2026 2107 - ret = register_netdev(net); 2027 + rtnl_lock(); 2028 + ret = register_netdevice(net); 2108 2029 if (ret != 0) { 2109 2030 pr_err("Unable to register netdev.\n"); 2110 2031 goto register_failed; 2111 2032 } 2112 2033 2113 - net_device_ctx->failover = failover_register(net, &netvsc_failover_ops); 2114 - if (IS_ERR(net_device_ctx->failover)) { 2115 - ret = PTR_ERR(net_device_ctx->failover); 2116 - goto err_failover; 2117 - } 2034 + list_add(&net_device_ctx->list, &netvsc_dev_list); 2035 + rtnl_unlock(); 2036 + return 0; 2118 2037 2119 - return ret; 2120 - 2121 - err_failover: 2122 - unregister_netdev(net); 2123 2038 register_failed: 2039 + rtnl_unlock(); 2124 2040 rndis_filter_device_remove(dev, nvdev); 2125 2041 rndis_failed: 2126 2042 free_percpu(net_device_ctx->vf_stats); ··· 2156 2080 rtnl_lock(); 2157 2081 vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); 2158 2082 if (vf_netdev) 2159 - failover_slave_unregister(vf_netdev); 2083 + netvsc_unregister_vf(vf_netdev); 2160 2084 2161 2085 if (nvdev) 2162 2086 rndis_filter_device_remove(dev, nvdev); 2163 2087 2164 2088 unregister_netdevice(net); 2165 - 2166 - failover_unregister(ndev_ctx->failover); 2089 + list_del(&ndev_ctx->list); 2167 2090 2168 2091 rtnl_unlock(); 2169 2092 rcu_read_unlock(); ··· 2190 2115 .remove = netvsc_remove, 2191 2116 }; 2192 2117 2118 + /* 2119 + * On Hyper-V, every VF interface is matched with a corresponding 2120 + * synthetic interface. The synthetic interface is presented first 2121 + * to the guest. When the corresponding VF instance is registered, 2122 + * we will take care of switching the data path. 2123 + */ 2124 + static int netvsc_netdev_event(struct notifier_block *this, 2125 + unsigned long event, void *ptr) 2126 + { 2127 + struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); 2128 + 2129 + /* Skip our own events */ 2130 + if (event_dev->netdev_ops == &device_ops) 2131 + return NOTIFY_DONE; 2132 + 2133 + /* Avoid non-Ethernet type devices */ 2134 + if (event_dev->type != ARPHRD_ETHER) 2135 + return NOTIFY_DONE; 2136 + 2137 + /* Avoid Vlan dev with same MAC registering as VF */ 2138 + if (is_vlan_dev(event_dev)) 2139 + return NOTIFY_DONE; 2140 + 2141 + /* Avoid Bonding master dev with same MAC registering as VF */ 2142 + if ((event_dev->priv_flags & IFF_BONDING) && 2143 + (event_dev->flags & IFF_MASTER)) 2144 + return NOTIFY_DONE; 2145 + 2146 + switch (event) { 2147 + case NETDEV_REGISTER: 2148 + return netvsc_register_vf(event_dev); 2149 + case NETDEV_UNREGISTER: 2150 + return netvsc_unregister_vf(event_dev); 2151 + case NETDEV_UP: 2152 + case NETDEV_DOWN: 2153 + return netvsc_vf_changed(event_dev); 2154 + default: 2155 + return NOTIFY_DONE; 2156 + } 2157 + } 2158 + 2159 + static struct notifier_block netvsc_netdev_notifier = { 2160 + .notifier_call = netvsc_netdev_event, 2161 + }; 2162 + 2193 2163 static void __exit netvsc_drv_exit(void) 2194 2164 { 2165 + unregister_netdevice_notifier(&netvsc_netdev_notifier); 2195 2166 vmbus_driver_unregister(&netvsc_drv); 2196 2167 } 2197 2168 ··· 2256 2135 if (ret) 2257 2136 return ret; 2258 2137 2138 + register_netdevice_notifier(&netvsc_netdev_notifier); 2259 2139 return 0; 2260 2140 } 2261 2141
-3
drivers/net/phy/mdio-gpio.c
··· 26 26 #include <linux/platform_device.h> 27 27 #include <linux/mdio-bitbang.h> 28 28 #include <linux/mdio-gpio.h> 29 - #include <linux/gpio.h> 30 29 #include <linux/gpio/consumer.h> 31 - 32 - #include <linux/of_gpio.h> 33 30 #include <linux/of_mdio.h> 34 31 35 32 struct mdio_gpio_info {
+9 -2
drivers/net/wireless/mac80211_hwsim.c
··· 3572 3572 hwsim_wq = alloc_workqueue("hwsim_wq", 0, 0); 3573 3573 if (!hwsim_wq) 3574 3574 return -ENOMEM; 3575 - rhashtable_init(&hwsim_radios_rht, &hwsim_rht_params); 3575 + 3576 + err = rhashtable_init(&hwsim_radios_rht, &hwsim_rht_params); 3577 + if (err) 3578 + goto out_free_wq; 3576 3579 3577 3580 err = register_pernet_device(&hwsim_net_ops); 3578 3581 if (err) 3579 - return err; 3582 + goto out_free_rht; 3580 3583 3581 3584 err = platform_driver_register(&mac80211_hwsim_driver); 3582 3585 if (err) ··· 3704 3701 platform_driver_unregister(&mac80211_hwsim_driver); 3705 3702 out_unregister_pernet: 3706 3703 unregister_pernet_device(&hwsim_net_ops); 3704 + out_free_rht: 3705 + rhashtable_destroy(&hwsim_radios_rht); 3706 + out_free_wq: 3707 + destroy_workqueue(hwsim_wq); 3707 3708 return err; 3708 3709 } 3709 3710 module_init(init_mac80211_hwsim);
+2 -2
drivers/net/xen-netfront.c
··· 239 239 static int netfront_tx_slot_available(struct netfront_queue *queue) 240 240 { 241 241 return (queue->tx.req_prod_pvt - queue->tx.rsp_cons) < 242 - (NET_TX_RING_SIZE - MAX_SKB_FRAGS - 2); 242 + (NET_TX_RING_SIZE - XEN_NETIF_NR_SLOTS_MIN - 1); 243 243 } 244 244 245 245 static void xennet_maybe_wake_tx(struct netfront_queue *queue) ··· 790 790 RING_IDX cons = queue->rx.rsp_cons; 791 791 struct sk_buff *skb = xennet_get_rx_skb(queue, cons); 792 792 grant_ref_t ref = xennet_get_rx_ref(queue, cons); 793 - int max = MAX_SKB_FRAGS + (rx->status <= RX_COPY_THRESHOLD); 793 + int max = XEN_NETIF_NR_SLOTS_MIN + (rx->status <= RX_COPY_THRESHOLD); 794 794 int slots = 1; 795 795 int err = 0; 796 796 unsigned long ret;
+1 -1
include/linux/netfilter.h
··· 345 345 346 346 rcu_read_lock(); 347 347 nat_hook = rcu_dereference(nf_nat_hook); 348 - if (nat_hook->decode_session) 348 + if (nat_hook && nat_hook->decode_session) 349 349 nat_hook->decode_session(skb, fl); 350 350 rcu_read_unlock(); 351 351 #endif
+14 -6
include/linux/netfilter/ipset/ip_set_timeout.h
··· 23 23 /* Set is defined with timeout support: timeout value may be 0 */ 24 24 #define IPSET_NO_TIMEOUT UINT_MAX 25 25 26 + /* Max timeout value, see msecs_to_jiffies() in jiffies.h */ 27 + #define IPSET_MAX_TIMEOUT (UINT_MAX >> 1)/MSEC_PER_SEC 28 + 26 29 #define ip_set_adt_opt_timeout(opt, set) \ 27 30 ((opt)->ext.timeout != IPSET_NO_TIMEOUT ? (opt)->ext.timeout : (set)->timeout) 28 31 ··· 35 32 unsigned int timeout = ip_set_get_h32(tb); 36 33 37 34 /* Normalize to fit into jiffies */ 38 - if (timeout > UINT_MAX/MSEC_PER_SEC) 39 - timeout = UINT_MAX/MSEC_PER_SEC; 35 + if (timeout > IPSET_MAX_TIMEOUT) 36 + timeout = IPSET_MAX_TIMEOUT; 40 37 41 - /* Userspace supplied TIMEOUT parameter: adjust crazy size */ 42 - return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; 38 + return timeout; 43 39 } 44 40 45 41 static inline bool ··· 67 65 static inline u32 68 66 ip_set_timeout_get(const unsigned long *timeout) 69 67 { 70 - return *timeout == IPSET_ELEM_PERMANENT ? 0 : 71 - jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC; 68 + u32 t; 69 + 70 + if (*timeout == IPSET_ELEM_PERMANENT) 71 + return 0; 72 + 73 + t = jiffies_to_msecs(*timeout - jiffies)/MSEC_PER_SEC; 74 + /* Zero value in userspace means no timeout */ 75 + return t == 0 ? 1 : t; 72 76 } 73 77 74 78 #endif /* __KERNEL__ */
+30
include/net/ip_vs.h
··· 631 631 632 632 /* alternate persistence engine */ 633 633 struct ip_vs_pe __rcu *pe; 634 + int conntrack_afmask; 634 635 635 636 struct rcu_head rcu_head; 636 637 }; ··· 1610 1609 return true; 1611 1610 #endif 1612 1611 return false; 1612 + } 1613 + 1614 + static inline int ip_vs_register_conntrack(struct ip_vs_service *svc) 1615 + { 1616 + #if IS_ENABLED(CONFIG_NF_CONNTRACK) 1617 + int afmask = (svc->af == AF_INET6) ? 2 : 1; 1618 + int ret = 0; 1619 + 1620 + if (!(svc->conntrack_afmask & afmask)) { 1621 + ret = nf_ct_netns_get(svc->ipvs->net, svc->af); 1622 + if (ret >= 0) 1623 + svc->conntrack_afmask |= afmask; 1624 + } 1625 + return ret; 1626 + #else 1627 + return 0; 1628 + #endif 1629 + } 1630 + 1631 + static inline void ip_vs_unregister_conntrack(struct ip_vs_service *svc) 1632 + { 1633 + #if IS_ENABLED(CONFIG_NF_CONNTRACK) 1634 + int afmask = (svc->af == AF_INET6) ? 2 : 1; 1635 + 1636 + if (svc->conntrack_afmask & afmask) { 1637 + nf_ct_netns_put(svc->ipvs->net, svc->af); 1638 + svc->conntrack_afmask &= ~afmask; 1639 + } 1640 + #endif 1613 1641 } 1614 1642 1615 1643 static inline int
+2 -1
include/net/netfilter/nf_conntrack_count.h
··· 20 20 bool *addit); 21 21 22 22 bool nf_conncount_add(struct hlist_head *head, 23 - const struct nf_conntrack_tuple *tuple); 23 + const struct nf_conntrack_tuple *tuple, 24 + const struct nf_conntrack_zone *zone); 24 25 25 26 void nf_conncount_cache_free(struct hlist_head *hhead); 26 27
-10
include/net/netfilter/nft_dup.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _NFT_DUP_H_ 3 - #define _NFT_DUP_H_ 4 - 5 - struct nft_dup_inet { 6 - enum nft_registers sreg_addr:8; 7 - enum nft_registers sreg_dev:8; 8 - }; 9 - 10 - #endif /* _NFT_DUP_H_ */
+5
include/net/sctp/structs.h
··· 1133 1133 }; 1134 1134 #define SCTP_INPUT_CB(__skb) ((struct sctp_input_cb *)&((__skb)->cb[0])) 1135 1135 1136 + struct sctp_output_cb { 1137 + struct sk_buff *last; 1138 + }; 1139 + #define SCTP_OUTPUT_CB(__skb) ((struct sctp_output_cb *)&((__skb)->cb[0])) 1140 + 1136 1141 static inline const struct sk_buff *sctp_gso_headskb(const struct sk_buff *skb) 1137 1142 { 1138 1143 const struct sctp_chunk *chunk = SCTP_INPUT_CB(skb)->chunk;
+2 -4
include/net/tls.h
··· 109 109 110 110 struct strparser strp; 111 111 void (*saved_data_ready)(struct sock *sk); 112 - unsigned int (*sk_poll)(struct file *file, struct socket *sock, 113 - struct poll_table_struct *wait); 112 + __poll_t (*sk_poll_mask)(struct socket *sock, __poll_t events); 114 113 struct sk_buff *recv_pkt; 115 114 u8 control; 116 115 bool decrypted; ··· 224 225 void tls_sw_free_resources_rx(struct sock *sk); 225 226 int tls_sw_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, 226 227 int nonblock, int flags, int *addr_len); 227 - unsigned int tls_sw_poll(struct file *file, struct socket *sock, 228 - struct poll_table_struct *wait); 228 + __poll_t tls_sw_poll_mask(struct socket *sock, __poll_t events); 229 229 ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos, 230 230 struct pipe_inode_info *pipe, 231 231 size_t len, unsigned int flags);
+1 -1
include/uapi/linux/netfilter/nf_conntrack_common.h
··· 112 112 IPS_EXPECTED | IPS_CONFIRMED | IPS_DYING | 113 113 IPS_SEQ_ADJUST | IPS_TEMPLATE | IPS_OFFLOAD), 114 114 115 - __IPS_MAX_BIT = 14, 115 + __IPS_MAX_BIT = 15, 116 116 }; 117 117 118 118 /* Connection tracking event types */
+1 -1
include/uapi/linux/netfilter/nf_tables.h
··· 266 266 * @NFT_SET_INTERVAL: set contains intervals 267 267 * @NFT_SET_MAP: set is used as a dictionary 268 268 * @NFT_SET_TIMEOUT: set uses timeouts 269 - * @NFT_SET_EVAL: set contains expressions for evaluation 269 + * @NFT_SET_EVAL: set can be updated from the evaluation path 270 270 * @NFT_SET_OBJECT: set contains stateful objects 271 271 */ 272 272 enum nft_set_flags {
+14 -14
include/uapi/linux/nl80211.h
··· 981 981 * only the %NL80211_ATTR_IE data is used and updated with this command. 982 982 * 983 983 * @NL80211_CMD_SET_PMK: For offloaded 4-Way handshake, set the PMK or PMK-R0 984 - * for the given authenticator address (specified with &NL80211_ATTR_MAC). 985 - * When &NL80211_ATTR_PMKR0_NAME is set, &NL80211_ATTR_PMK specifies the 984 + * for the given authenticator address (specified with %NL80211_ATTR_MAC). 985 + * When %NL80211_ATTR_PMKR0_NAME is set, %NL80211_ATTR_PMK specifies the 986 986 * PMK-R0, otherwise it specifies the PMK. 987 987 * @NL80211_CMD_DEL_PMK: For offloaded 4-Way handshake, delete the previously 988 988 * configured PMK for the authenticator address identified by 989 - * &NL80211_ATTR_MAC. 989 + * %NL80211_ATTR_MAC. 990 990 * @NL80211_CMD_PORT_AUTHORIZED: An event that indicates that the 4 way 991 991 * handshake was completed successfully by the driver. The BSSID is 992 - * specified with &NL80211_ATTR_MAC. Drivers that support 4 way handshake 992 + * specified with %NL80211_ATTR_MAC. Drivers that support 4 way handshake 993 993 * offload should send this event after indicating 802.11 association with 994 - * &NL80211_CMD_CONNECT or &NL80211_CMD_ROAM. If the 4 way handshake failed 995 - * &NL80211_CMD_DISCONNECT should be indicated instead. 994 + * %NL80211_CMD_CONNECT or %NL80211_CMD_ROAM. If the 4 way handshake failed 995 + * %NL80211_CMD_DISCONNECT should be indicated instead. 996 996 * 997 997 * @NL80211_CMD_CONTROL_PORT_FRAME: Control Port (e.g. PAE) frame TX request 998 998 * and RX notification. This command is used both as a request to transmit ··· 1029 1029 * initiated the connection through the connect request. 1030 1030 * 1031 1031 * @NL80211_CMD_STA_OPMODE_CHANGED: An event that notify station's 1032 - * ht opmode or vht opmode changes using any of &NL80211_ATTR_SMPS_MODE, 1033 - * &NL80211_ATTR_CHANNEL_WIDTH,&NL80211_ATTR_NSS attributes with its 1034 - * address(specified in &NL80211_ATTR_MAC). 1032 + * ht opmode or vht opmode changes using any of %NL80211_ATTR_SMPS_MODE, 1033 + * %NL80211_ATTR_CHANNEL_WIDTH,%NL80211_ATTR_NSS attributes with its 1034 + * address(specified in %NL80211_ATTR_MAC). 1035 1035 * 1036 1036 * @NL80211_CMD_MAX: highest used command number 1037 1037 * @__NL80211_CMD_AFTER_LAST: internal use ··· 2218 2218 * @NL80211_ATTR_EXTERNAL_AUTH_ACTION: Identify the requested external 2219 2219 * authentication operation (u32 attribute with an 2220 2220 * &enum nl80211_external_auth_action value). This is used with the 2221 - * &NL80211_CMD_EXTERNAL_AUTH request event. 2221 + * %NL80211_CMD_EXTERNAL_AUTH request event. 2222 2222 * @NL80211_ATTR_EXTERNAL_AUTH_SUPPORT: Flag attribute indicating that the user 2223 2223 * space supports external authentication. This attribute shall be used 2224 2224 * only with %NL80211_CMD_CONNECT request. The driver may offload ··· 3491 3491 * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated 3492 3492 * base on contiguous rules and wider channels will be allowed to cross 3493 3493 * multiple contiguous/overlapping frequency ranges. 3494 - * @NL80211_RRF_IR_CONCURRENT: See &NL80211_FREQUENCY_ATTR_IR_CONCURRENT 3494 + * @NL80211_RRF_IR_CONCURRENT: See %NL80211_FREQUENCY_ATTR_IR_CONCURRENT 3495 3495 * @NL80211_RRF_NO_HT40MINUS: channels can't be used in HT40- operation 3496 3496 * @NL80211_RRF_NO_HT40PLUS: channels can't be used in HT40+ operation 3497 3497 * @NL80211_RRF_NO_80MHZ: 80MHz operation not allowed ··· 5643 5643 * @NL80211_NAN_SRF_INCLUDE: present if the include bit of the SRF set. 5644 5644 * This is a flag. 5645 5645 * @NL80211_NAN_SRF_BF: Bloom Filter. Present if and only if 5646 - * &NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary. 5646 + * %NL80211_NAN_SRF_MAC_ADDRS isn't present. This attribute is binary. 5647 5647 * @NL80211_NAN_SRF_BF_IDX: index of the Bloom Filter. Mandatory if 5648 - * &NL80211_NAN_SRF_BF is present. This is a u8. 5648 + * %NL80211_NAN_SRF_BF is present. This is a u8. 5649 5649 * @NL80211_NAN_SRF_MAC_ADDRS: list of MAC addresses for the SRF. Present if 5650 - * and only if &NL80211_NAN_SRF_BF isn't present. This is a nested 5650 + * and only if %NL80211_NAN_SRF_BF isn't present. This is a nested 5651 5651 * attribute. Each nested attribute is a MAC address. 5652 5652 * @NUM_NL80211_NAN_SRF_ATTR: internal 5653 5653 * @NL80211_NAN_SRF_ATTR_MAX: highest NAN SRF attribute
+12 -2
kernel/bpf/inode.c
··· 295 295 .release = bpffs_map_release, 296 296 }; 297 297 298 + static int bpffs_obj_open(struct inode *inode, struct file *file) 299 + { 300 + return -EIO; 301 + } 302 + 303 + static const struct file_operations bpffs_obj_fops = { 304 + .open = bpffs_obj_open, 305 + }; 306 + 298 307 static int bpf_mkobj_ops(struct dentry *dentry, umode_t mode, void *raw, 299 308 const struct inode_operations *iops, 300 309 const struct file_operations *fops) ··· 323 314 324 315 static int bpf_mkprog(struct dentry *dentry, umode_t mode, void *arg) 325 316 { 326 - return bpf_mkobj_ops(dentry, mode, arg, &bpf_prog_iops, NULL); 317 + return bpf_mkobj_ops(dentry, mode, arg, &bpf_prog_iops, 318 + &bpffs_obj_fops); 327 319 } 328 320 329 321 static int bpf_mkmap(struct dentry *dentry, umode_t mode, void *arg) ··· 332 322 struct bpf_map *map = arg; 333 323 334 324 return bpf_mkobj_ops(dentry, mode, arg, &bpf_map_iops, 335 - map->btf ? &bpffs_map_fops : NULL); 325 + map->btf ? &bpffs_map_fops : &bpffs_obj_fops); 336 326 } 337 327 338 328 static struct dentry *
+20 -5
net/bridge/netfilter/ebtables.c
··· 411 411 watcher = xt_request_find_target(NFPROTO_BRIDGE, w->u.name, 0); 412 412 if (IS_ERR(watcher)) 413 413 return PTR_ERR(watcher); 414 + 415 + if (watcher->family != NFPROTO_BRIDGE) { 416 + module_put(watcher->me); 417 + return -ENOENT; 418 + } 419 + 414 420 w->u.watcher = watcher; 415 421 416 422 par->target = watcher; ··· 715 709 } 716 710 i = 0; 717 711 712 + memset(&mtpar, 0, sizeof(mtpar)); 713 + memset(&tgpar, 0, sizeof(tgpar)); 718 714 mtpar.net = tgpar.net = net; 719 715 mtpar.table = tgpar.table = name; 720 716 mtpar.entryinfo = tgpar.entryinfo = e; ··· 735 727 target = xt_request_find_target(NFPROTO_BRIDGE, t->u.name, 0); 736 728 if (IS_ERR(target)) { 737 729 ret = PTR_ERR(target); 730 + goto cleanup_watchers; 731 + } 732 + 733 + /* Reject UNSPEC, xtables verdicts/return values are incompatible */ 734 + if (target->family != NFPROTO_BRIDGE) { 735 + module_put(target->me); 736 + ret = -ENOENT; 738 737 goto cleanup_watchers; 739 738 } 740 739 ··· 1621 1606 compat_uptr_t ptr; 1622 1607 } u; 1623 1608 compat_uint_t match_size; 1624 - compat_uint_t data[0]; 1609 + compat_uint_t data[0] __attribute__ ((aligned (__alignof__(struct compat_ebt_replace)))); 1625 1610 }; 1626 1611 1627 1612 /* account for possible padding between match_size and ->data */ 1628 1613 static int ebt_compat_entry_padsize(void) 1629 1614 { 1630 - BUILD_BUG_ON(XT_ALIGN(sizeof(struct ebt_entry_match)) < 1631 - COMPAT_XT_ALIGN(sizeof(struct compat_ebt_entry_mwt))); 1632 - return (int) XT_ALIGN(sizeof(struct ebt_entry_match)) - 1633 - COMPAT_XT_ALIGN(sizeof(struct compat_ebt_entry_mwt)); 1615 + BUILD_BUG_ON(sizeof(struct ebt_entry_match) < 1616 + sizeof(struct compat_ebt_entry_mwt)); 1617 + return (int) sizeof(struct ebt_entry_match) - 1618 + sizeof(struct compat_ebt_entry_mwt); 1634 1619 } 1635 1620 1636 1621 static int ebt_compat_match_offset(const struct xt_match *match,
+1 -1
net/bridge/netfilter/nft_reject_bridge.c
··· 261 261 if (!reject6_br_csum_ok(oldskb, hook)) 262 262 return; 263 263 264 - nskb = alloc_skb(sizeof(struct iphdr) + sizeof(struct icmp6hdr) + 264 + nskb = alloc_skb(sizeof(struct ipv6hdr) + sizeof(struct icmp6hdr) + 265 265 LL_MAX_HEADER + len, GFP_ATOMIC); 266 266 if (!nskb) 267 267 return;
+6 -4
net/core/neighbour.c
··· 119 119 EXPORT_SYMBOL(neigh_rand_reach_time); 120 120 121 121 122 - static bool neigh_del(struct neighbour *n, __u8 state, 122 + static bool neigh_del(struct neighbour *n, __u8 state, __u8 flags, 123 123 struct neighbour __rcu **np, struct neigh_table *tbl) 124 124 { 125 125 bool retval = false; 126 126 127 127 write_lock(&n->lock); 128 - if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state)) { 128 + if (refcount_read(&n->refcnt) == 1 && !(n->nud_state & state) && 129 + !(n->flags & flags)) { 129 130 struct neighbour *neigh; 130 131 131 132 neigh = rcu_dereference_protected(n->next, ··· 158 157 while ((n = rcu_dereference_protected(*np, 159 158 lockdep_is_held(&tbl->lock)))) { 160 159 if (n == ndel) 161 - return neigh_del(n, 0, np, tbl); 160 + return neigh_del(n, 0, 0, np, tbl); 162 161 np = &n->next; 163 162 } 164 163 return false; ··· 186 185 * - nobody refers to it. 187 186 * - it is not permanent 188 187 */ 189 - if (neigh_del(n, NUD_PERMANENT, np, tbl)) { 188 + if (neigh_del(n, NUD_PERMANENT, NTF_EXT_LEARNED, np, 189 + tbl)) { 190 190 shrunk = 1; 191 191 continue; 192 192 }
+1 -14
net/core/sock.c
··· 728 728 sock_valbool_flag(sk, SOCK_DBG, valbool); 729 729 break; 730 730 case SO_REUSEADDR: 731 - val = (valbool ? SK_CAN_REUSE : SK_NO_REUSE); 732 - if ((sk->sk_family == PF_INET || sk->sk_family == PF_INET6) && 733 - inet_sk(sk)->inet_num && 734 - (sk->sk_reuse != val)) { 735 - ret = (sk->sk_state == TCP_ESTABLISHED) ? -EISCONN : -EUCLEAN; 736 - break; 737 - } 738 - sk->sk_reuse = val; 731 + sk->sk_reuse = (valbool ? SK_CAN_REUSE : SK_NO_REUSE); 739 732 break; 740 733 case SO_REUSEPORT: 741 - if ((sk->sk_family == PF_INET || sk->sk_family == PF_INET6) && 742 - inet_sk(sk)->inet_num && 743 - (sk->sk_reuseport != valbool)) { 744 - ret = (sk->sk_state == TCP_ESTABLISHED) ? -EISCONN : -EUCLEAN; 745 - break; 746 - } 747 734 sk->sk_reuseport = valbool; 748 735 break; 749 736 case SO_TYPE:
+2 -1
net/dsa/tag_trailer.c
··· 75 75 if (!skb->dev) 76 76 return NULL; 77 77 78 - pskb_trim_rcsum(skb, skb->len - 4); 78 + if (pskb_trim_rcsum(skb, skb->len - 4)) 79 + return NULL; 79 80 80 81 return skb; 81 82 }
+1
net/ipv4/netfilter/ip_tables.c
··· 531 531 return -ENOMEM; 532 532 533 533 j = 0; 534 + memset(&mtpar, 0, sizeof(mtpar)); 534 535 mtpar.net = net; 535 536 mtpar.table = name; 536 537 mtpar.entryinfo = &e->ip;
+4
net/ipv4/tcp_ipv4.c
··· 1730 1730 reqsk_put(req); 1731 1731 goto discard_it; 1732 1732 } 1733 + if (tcp_checksum_complete(skb)) { 1734 + reqsk_put(req); 1735 + goto csum_error; 1736 + } 1733 1737 if (unlikely(sk->sk_state != TCP_LISTEN)) { 1734 1738 inet_csk_reqsk_queue_drop_and_put(sk, req); 1735 1739 goto lookup;
-2
net/ipv4/tcp_offload.c
··· 268 268 goto out_check_final; 269 269 } 270 270 271 - p = *head; 272 - th2 = tcp_hdr(p); 273 271 tcp_flag_word(th2) |= flags & (TCP_FLAG_FIN | TCP_FLAG_PSH); 274 272 275 273 out_check_final:
+1 -1
net/ipv6/addrconf.c
··· 1324 1324 } 1325 1325 } 1326 1326 1327 + memset(&cfg, 0, sizeof(cfg)); 1327 1328 cfg.valid_lft = min_t(__u32, ifp->valid_lft, 1328 1329 idev->cnf.temp_valid_lft + age); 1329 1330 cfg.preferred_lft = cnf_temp_preferred_lft + age - idev->desync_factor; ··· 1358 1357 1359 1358 cfg.pfx = &addr; 1360 1359 cfg.scope = ipv6_addr_scope(cfg.pfx); 1361 - cfg.rt_priority = 0; 1362 1360 1363 1361 ift = ipv6_add_addr(idev, &cfg, block, NULL); 1364 1362 if (IS_ERR(ift)) {
+2 -3
net/ipv6/ip6_fib.c
··· 934 934 { 935 935 struct fib6_info *leaf = rcu_dereference_protected(fn->leaf, 936 936 lockdep_is_held(&rt->fib6_table->tb6_lock)); 937 + enum fib_event_type event = FIB_EVENT_ENTRY_ADD; 937 938 struct fib6_info *iter = NULL, *match = NULL; 938 939 struct fib6_info __rcu **ins; 939 940 int replace = (info->nlh && ··· 1014 1013 "Can not append to a REJECT route"); 1015 1014 return -EINVAL; 1016 1015 } 1016 + event = FIB_EVENT_ENTRY_APPEND; 1017 1017 rt->fib6_nsiblings = match->fib6_nsiblings; 1018 1018 list_add_tail(&rt->fib6_siblings, &match->fib6_siblings); 1019 1019 match->fib6_nsiblings++; ··· 1036 1034 * insert node 1037 1035 */ 1038 1036 if (!replace) { 1039 - enum fib_event_type event; 1040 - 1041 1037 if (!add) 1042 1038 pr_warn("NLM_F_CREATE should be set when creating new route\n"); 1043 1039 1044 1040 add: 1045 1041 nlflags |= NLM_F_CREATE; 1046 1042 1047 - event = append ? FIB_EVENT_ENTRY_APPEND : FIB_EVENT_ENTRY_ADD; 1048 1043 err = call_fib6_entry_notifiers(info->nl_net, event, rt, 1049 1044 extack); 1050 1045 if (err)
+1
net/ipv6/netfilter/ip6_tables.c
··· 550 550 return -ENOMEM; 551 551 552 552 j = 0; 553 + memset(&mtpar, 0, sizeof(mtpar)); 553 554 mtpar.net = net; 554 555 mtpar.table = name; 555 556 mtpar.entryinfo = &e->ipv6;
-3
net/ipv6/route.c
··· 2307 2307 const struct in6_addr *daddr, *saddr; 2308 2308 struct rt6_info *rt6 = (struct rt6_info *)dst; 2309 2309 2310 - if (rt6->rt6i_flags & RTF_LOCAL) 2311 - return; 2312 - 2313 2310 if (dst_metric_locked(dst, RTAX_MTU)) 2314 2311 return; 2315 2312
+4
net/ipv6/tcp_ipv6.c
··· 1479 1479 reqsk_put(req); 1480 1480 goto discard_it; 1481 1481 } 1482 + if (tcp_checksum_complete(skb)) { 1483 + reqsk_put(req); 1484 + goto csum_error; 1485 + } 1482 1486 if (unlikely(sk->sk_state != TCP_LISTEN)) { 1483 1487 inet_csk_reqsk_queue_drop_and_put(sk, req); 1484 1488 goto lookup;
+6
net/l2tp/l2tp_netlink.c
··· 553 553 goto out_tunnel; 554 554 } 555 555 556 + /* L2TPv2 only accepts PPP pseudo-wires */ 557 + if (tunnel->version == 2 && cfg.pw_type != L2TP_PWTYPE_PPP) { 558 + ret = -EPROTONOSUPPORT; 559 + goto out_tunnel; 560 + } 561 + 556 562 if (tunnel->version > 2) { 557 563 if (info->attrs[L2TP_ATTR_DATA_SEQ]) 558 564 cfg.data_seq = nla_get_u8(info->attrs[L2TP_ATTR_DATA_SEQ]);
+27 -1
net/l2tp/l2tp_ppp.c
··· 612 612 u32 session_id, peer_session_id; 613 613 bool drop_refcnt = false; 614 614 bool drop_tunnel = false; 615 + bool new_session = false; 616 + bool new_tunnel = false; 615 617 int ver = 2; 616 618 int fd; 617 619 ··· 703 701 .encap = L2TP_ENCAPTYPE_UDP, 704 702 .debug = 0, 705 703 }; 704 + 705 + /* Prevent l2tp_tunnel_register() from trying to set up 706 + * a kernel socket. 707 + */ 708 + if (fd < 0) { 709 + error = -EBADF; 710 + goto end; 711 + } 712 + 706 713 error = l2tp_tunnel_create(sock_net(sk), fd, ver, tunnel_id, peer_tunnel_id, &tcfg, &tunnel); 707 714 if (error < 0) 708 715 goto end; ··· 724 713 goto end; 725 714 } 726 715 drop_tunnel = true; 716 + new_tunnel = true; 727 717 } 728 718 } else { 729 719 /* Error if we can't find the tunnel */ ··· 746 734 session = l2tp_session_get(sock_net(sk), tunnel, session_id); 747 735 if (session) { 748 736 drop_refcnt = true; 737 + 738 + if (session->pwtype != L2TP_PWTYPE_PPP) { 739 + error = -EPROTOTYPE; 740 + goto end; 741 + } 742 + 749 743 ps = l2tp_session_priv(session); 750 744 751 745 /* Using a pre-existing session is fine as long as it hasn't ··· 769 751 /* Default MTU must allow space for UDP/L2TP/PPP headers */ 770 752 cfg.mtu = 1500 - PPPOL2TP_HEADER_OVERHEAD; 771 753 cfg.mru = cfg.mtu; 754 + cfg.pw_type = L2TP_PWTYPE_PPP; 772 755 773 756 session = l2tp_session_create(sizeof(struct pppol2tp_session), 774 757 tunnel, session_id, ··· 791 772 goto end; 792 773 } 793 774 drop_refcnt = true; 775 + new_session = true; 794 776 } 795 777 796 778 /* Special case: if source & dest session_id == 0x0000, this ··· 838 818 session->name); 839 819 840 820 end: 821 + if (error) { 822 + if (new_session) 823 + l2tp_session_delete(session); 824 + if (new_tunnel) 825 + l2tp_tunnel_delete(tunnel); 826 + } 841 827 if (drop_refcnt) 842 828 l2tp_session_dec_refcount(session); 843 829 if (drop_tunnel) ··· 1201 1175 l2tp_session_get(sock_net(sk), tunnel, 1202 1176 stats.session_id); 1203 1177 1204 - if (session) { 1178 + if (session && session->pwtype == L2TP_PWTYPE_PPP) { 1205 1179 err = pppol2tp_session_ioctl(session, cmd, 1206 1180 arg); 1207 1181 l2tp_session_dec_refcount(session);
+6 -6
net/mac80211/main.c
··· 1098 1098 1099 1099 ieee80211_led_init(local); 1100 1100 1101 + result = ieee80211_txq_setup_flows(local); 1102 + if (result) 1103 + goto fail_flows; 1104 + 1101 1105 rtnl_lock(); 1102 1106 1103 1107 result = ieee80211_init_rate_ctrl_alg(local, ··· 1123 1119 } 1124 1120 1125 1121 rtnl_unlock(); 1126 - 1127 - result = ieee80211_txq_setup_flows(local); 1128 - if (result) 1129 - goto fail_flows; 1130 1122 1131 1123 #ifdef CONFIG_INET 1132 1124 local->ifa_notifier.notifier_call = ieee80211_ifa_changed; ··· 1149 1149 #if defined(CONFIG_INET) || defined(CONFIG_IPV6) 1150 1150 fail_ifa: 1151 1151 #endif 1152 - ieee80211_txq_teardown_flows(local); 1153 - fail_flows: 1154 1152 rtnl_lock(); 1155 1153 rate_control_deinitialize(local); 1156 1154 ieee80211_remove_interfaces(local); ··· 1156 1158 rtnl_unlock(); 1157 1159 ieee80211_led_exit(local); 1158 1160 ieee80211_wep_free(local); 1161 + ieee80211_txq_teardown_flows(local); 1162 + fail_flows: 1159 1163 destroy_workqueue(local->workqueue); 1160 1164 fail_workqueue: 1161 1165 wiphy_unregister(local->hw.wiphy);
+4 -1
net/netfilter/ipset/ip_set_hash_gen.h
··· 1234 1234 pr_debug("Create set %s with family %s\n", 1235 1235 set->name, set->family == NFPROTO_IPV4 ? "inet" : "inet6"); 1236 1236 1237 - #ifndef IP_SET_PROTO_UNDEF 1237 + #ifdef IP_SET_PROTO_UNDEF 1238 + if (set->family != NFPROTO_UNSPEC) 1239 + return -IPSET_ERR_INVALID_FAMILY; 1240 + #else 1238 1241 if (!(set->family == NFPROTO_IPV4 || set->family == NFPROTO_IPV6)) 1239 1242 return -IPSET_ERR_INVALID_FAMILY; 1240 1243 #endif
+4
net/netfilter/ipvs/ip_vs_ctl.c
··· 839 839 * For now only for NAT! 840 840 */ 841 841 ip_vs_rs_hash(ipvs, dest); 842 + /* FTP-NAT requires conntrack for mangling */ 843 + if (svc->port == FTPPORT) 844 + ip_vs_register_conntrack(svc); 842 845 } 843 846 atomic_set(&dest->conn_flags, conn_flags); 844 847 ··· 1465 1462 */ 1466 1463 static void ip_vs_unlink_service(struct ip_vs_service *svc, bool cleanup) 1467 1464 { 1465 + ip_vs_unregister_conntrack(svc); 1468 1466 /* Hold svc to avoid double release from dest_trash */ 1469 1467 atomic_inc(&svc->refcnt); 1470 1468 /*
+1 -1
net/netfilter/ipvs/ip_vs_xmit.c
··· 168 168 bool new_rt_is_local) 169 169 { 170 170 bool rt_mode_allow_local = !!(rt_mode & IP_VS_RT_MODE_LOCAL); 171 - bool rt_mode_allow_non_local = !!(rt_mode & IP_VS_RT_MODE_LOCAL); 171 + bool rt_mode_allow_non_local = !!(rt_mode & IP_VS_RT_MODE_NON_LOCAL); 172 172 bool rt_mode_allow_redirect = !!(rt_mode & IP_VS_RT_MODE_RDR); 173 173 bool source_is_loopback; 174 174 bool old_rt_is_local;
+9 -4
net/netfilter/nf_conncount.c
··· 46 46 struct nf_conncount_tuple { 47 47 struct hlist_node node; 48 48 struct nf_conntrack_tuple tuple; 49 + struct nf_conntrack_zone zone; 49 50 }; 50 51 51 52 struct nf_conncount_rb { ··· 81 80 } 82 81 83 82 bool nf_conncount_add(struct hlist_head *head, 84 - const struct nf_conntrack_tuple *tuple) 83 + const struct nf_conntrack_tuple *tuple, 84 + const struct nf_conntrack_zone *zone) 85 85 { 86 86 struct nf_conncount_tuple *conn; 87 87 ··· 90 88 if (conn == NULL) 91 89 return false; 92 90 conn->tuple = *tuple; 91 + conn->zone = *zone; 93 92 hlist_add_head(&conn->node, head); 94 93 return true; 95 94 } ··· 111 108 112 109 /* check the saved connections */ 113 110 hlist_for_each_entry_safe(conn, n, head, node) { 114 - found = nf_conntrack_find_get(net, zone, &conn->tuple); 111 + found = nf_conntrack_find_get(net, &conn->zone, &conn->tuple); 115 112 if (found == NULL) { 116 113 hlist_del(&conn->node); 117 114 kmem_cache_free(conncount_conn_cachep, conn); ··· 120 117 121 118 found_ct = nf_ct_tuplehash_to_ctrack(found); 122 119 123 - if (tuple && nf_ct_tuple_equal(&conn->tuple, tuple)) { 120 + if (tuple && nf_ct_tuple_equal(&conn->tuple, tuple) && 121 + nf_ct_zone_equal(found_ct, zone, zone->dir)) { 124 122 /* 125 123 * Just to be sure we have it only once in the list. 126 124 * We should not see tuples twice unless someone hooks ··· 200 196 if (!addit) 201 197 return count; 202 198 203 - if (!nf_conncount_add(&rbconn->hhead, tuple)) 199 + if (!nf_conncount_add(&rbconn->hhead, tuple, zone)) 204 200 return 0; /* hotdrop */ 205 201 206 202 return count + 1; ··· 242 238 } 243 239 244 240 conn->tuple = *tuple; 241 + conn->zone = *zone; 245 242 memcpy(rbconn->key, key, sizeof(u32) * keylen); 246 243 247 244 INIT_HLIST_HEAD(&rbconn->hhead);
+2 -1
net/netfilter/nf_conntrack_netlink.c
··· 1446 1446 } 1447 1447 nfnl_lock(NFNL_SUBSYS_CTNETLINK); 1448 1448 rcu_read_lock(); 1449 - if (nat_hook->parse_nat_setup) 1449 + nat_hook = rcu_dereference(nf_nat_hook); 1450 + if (nat_hook) 1450 1451 return -EAGAIN; 1451 1452 #endif 1452 1453 return -EOPNOTSUPP;
+25 -11
net/netfilter/nf_tables_api.c
··· 2890 2890 u32 id = ntohl(nla_get_be32(nla)); 2891 2891 2892 2892 list_for_each_entry(trans, &net->nft.commit_list, list) { 2893 - struct nft_set *set = nft_trans_set(trans); 2893 + if (trans->msg_type == NFT_MSG_NEWSET) { 2894 + struct nft_set *set = nft_trans_set(trans); 2894 2895 2895 - if (trans->msg_type == NFT_MSG_NEWSET && 2896 - id == nft_trans_set_id(trans) && 2897 - nft_active_genmask(set, genmask)) 2898 - return set; 2896 + if (id == nft_trans_set_id(trans) && 2897 + nft_active_genmask(set, genmask)) 2898 + return set; 2899 + } 2899 2900 } 2900 2901 return ERR_PTR(-ENOENT); 2901 2902 } ··· 5837 5836 struct net_device *dev = netdev_notifier_info_to_dev(ptr); 5838 5837 struct nft_flowtable *flowtable; 5839 5838 struct nft_table *table; 5839 + struct net *net; 5840 5840 5841 5841 if (event != NETDEV_UNREGISTER) 5842 5842 return 0; 5843 5843 5844 + net = maybe_get_net(dev_net(dev)); 5845 + if (!net) 5846 + return 0; 5847 + 5844 5848 nfnl_lock(NFNL_SUBSYS_NFTABLES); 5845 - list_for_each_entry(table, &dev_net(dev)->nft.tables, list) { 5849 + list_for_each_entry(table, &net->nft.tables, list) { 5846 5850 list_for_each_entry(flowtable, &table->flowtables, list) { 5847 5851 nft_flowtable_event(event, dev, flowtable); 5848 5852 } 5849 5853 } 5850 5854 nfnl_unlock(NFNL_SUBSYS_NFTABLES); 5851 - 5855 + put_net(net); 5852 5856 return NOTIFY_DONE; 5853 5857 } 5854 5858 ··· 6444 6438 kfree(trans); 6445 6439 } 6446 6440 6447 - static int nf_tables_abort(struct net *net, struct sk_buff *skb) 6441 + static int __nf_tables_abort(struct net *net) 6448 6442 { 6449 6443 struct nft_trans *trans, *next; 6450 6444 struct nft_trans_elem *te; ··· 6558 6552 static void nf_tables_cleanup(struct net *net) 6559 6553 { 6560 6554 nft_validate_state_update(net, NFT_VALIDATE_SKIP); 6555 + } 6556 + 6557 + static int nf_tables_abort(struct net *net, struct sk_buff *skb) 6558 + { 6559 + return __nf_tables_abort(net); 6561 6560 } 6562 6561 6563 6562 static bool nf_tables_valid_genid(struct net *net, u32 genid) ··· 7159 7148 7160 7149 static void __net_exit nf_tables_exit_net(struct net *net) 7161 7150 { 7151 + nfnl_lock(NFNL_SUBSYS_NFTABLES); 7152 + if (!list_empty(&net->nft.commit_list)) 7153 + __nf_tables_abort(net); 7162 7154 __nft_release_tables(net); 7155 + nfnl_unlock(NFNL_SUBSYS_NFTABLES); 7163 7156 WARN_ON_ONCE(!list_empty(&net->nft.tables)); 7164 - WARN_ON_ONCE(!list_empty(&net->nft.commit_list)); 7165 7157 } 7166 7158 7167 7159 static struct pernet_operations nf_tables_net_ops = { ··· 7206 7192 7207 7193 static void __exit nf_tables_module_exit(void) 7208 7194 { 7209 - unregister_pernet_subsys(&nf_tables_net_ops); 7210 7195 nfnetlink_subsys_unregister(&nf_tables_subsys); 7211 7196 unregister_netdevice_notifier(&nf_tables_flowtable_notifier); 7197 + nft_chain_filter_fini(); 7198 + unregister_pernet_subsys(&nf_tables_net_ops); 7212 7199 rcu_barrier(); 7213 7200 nf_tables_core_module_exit(); 7214 7201 kfree(info); 7215 - nft_chain_filter_fini(); 7216 7202 } 7217 7203 7218 7204 module_init(nf_tables_module_init);
+2 -1
net/netfilter/nf_tables_core.c
··· 183 183 184 184 switch (regs.verdict.code) { 185 185 case NFT_JUMP: 186 - BUG_ON(stackptr >= NFT_JUMP_STACK_SIZE); 186 + if (WARN_ON_ONCE(stackptr >= NFT_JUMP_STACK_SIZE)) 187 + return NF_DROP; 187 188 jumpstack[stackptr].chain = chain; 188 189 jumpstack[stackptr].rules = rules + 1; 189 190 stackptr++;
+7 -3
net/netfilter/nfnetlink.c
··· 429 429 */ 430 430 if (err == -EAGAIN) { 431 431 status |= NFNL_BATCH_REPLAY; 432 - goto next; 432 + goto done; 433 433 } 434 434 } 435 435 ack: ··· 456 456 if (err) 457 457 status |= NFNL_BATCH_FAILURE; 458 458 } 459 - next: 459 + 460 460 msglen = NLMSG_ALIGN(nlh->nlmsg_len); 461 461 if (msglen > skb->len) 462 462 msglen = skb->len; ··· 464 464 } 465 465 done: 466 466 if (status & NFNL_BATCH_REPLAY) { 467 - ss->abort(net, oskb); 467 + const struct nfnetlink_subsystem *ss2; 468 + 469 + ss2 = nfnl_dereference_protected(subsys_id); 470 + if (ss2 == ss) 471 + ss->abort(net, oskb); 468 472 nfnl_err_reset(&err_list); 469 473 nfnl_unlock(subsys_id); 470 474 kfree_skb(skb);
+5
net/netfilter/nft_chain_filter.c
··· 318 318 event != NETDEV_CHANGENAME) 319 319 return NOTIFY_DONE; 320 320 321 + ctx.net = maybe_get_net(ctx.net); 322 + if (!ctx.net) 323 + return NOTIFY_DONE; 324 + 321 325 nfnl_lock(NFNL_SUBSYS_NFTABLES); 322 326 list_for_each_entry(table, &ctx.net->nft.tables, list) { 323 327 if (table->family != NFPROTO_NETDEV) ··· 338 334 } 339 335 } 340 336 nfnl_unlock(NFNL_SUBSYS_NFTABLES); 337 + put_net(ctx.net); 341 338 342 339 return NOTIFY_DONE; 343 340 }
+1 -1
net/netfilter/nft_connlimit.c
··· 52 52 if (!addit) 53 53 goto out; 54 54 55 - if (!nf_conncount_add(&priv->hhead, tuple_ptr)) { 55 + if (!nf_conncount_add(&priv->hhead, tuple_ptr, zone)) { 56 56 regs->verdict.code = NF_DROP; 57 57 spin_unlock_bh(&priv->lock); 58 58 return;
+1 -3
net/netfilter/nft_dynset.c
··· 203 203 goto err1; 204 204 set->ops->gc_init(set); 205 205 } 206 - 207 - } else if (set->flags & NFT_SET_EVAL) 208 - return -EINVAL; 206 + } 209 207 210 208 nft_set_ext_prepare(&priv->tmpl); 211 209 nft_set_ext_add_length(&priv->tmpl, NFT_SET_EXT_KEY, set->klen);
+1 -1
net/netfilter/nft_set_rbtree.c
··· 66 66 parent = rcu_dereference_raw(parent->rb_left); 67 67 if (interval && 68 68 nft_rbtree_equal(set, this, interval) && 69 - nft_rbtree_interval_end(this) && 69 + nft_rbtree_interval_end(rbe) && 70 70 !nft_rbtree_interval_end(interval)) 71 71 continue; 72 72 interval = rbe;
+1
net/netfilter/nft_socket.c
··· 142 142 MODULE_LICENSE("GPL"); 143 143 MODULE_AUTHOR("Máté Eckl"); 144 144 MODULE_DESCRIPTION("nf_tables socket match module"); 145 + MODULE_ALIAS_NFT_EXPR("socket");
+10
net/netfilter/xt_CT.c
··· 245 245 } 246 246 247 247 if (info->helper[0]) { 248 + if (strnlen(info->helper, sizeof(info->helper)) == sizeof(info->helper)) { 249 + ret = -ENAMETOOLONG; 250 + goto err3; 251 + } 252 + 248 253 ret = xt_ct_set_helper(ct, info->helper, par); 249 254 if (ret < 0) 250 255 goto err3; 251 256 } 252 257 253 258 if (info->timeout[0]) { 259 + if (strnlen(info->timeout, sizeof(info->timeout)) == sizeof(info->timeout)) { 260 + ret = -ENAMETOOLONG; 261 + goto err4; 262 + } 263 + 254 264 ret = xt_ct_set_timeout(ct, par, info->timeout); 255 265 if (ret < 0) 256 266 goto err4;
+1 -1
net/netfilter/xt_connmark.c
··· 211 211 static void __exit connmark_mt_exit(void) 212 212 { 213 213 xt_unregister_match(&connmark_mt_reg); 214 - xt_unregister_target(connmark_tg_reg); 214 + xt_unregister_targets(connmark_tg_reg, ARRAY_SIZE(connmark_tg_reg)); 215 215 } 216 216 217 217 module_init(connmark_mt_init);
+5 -5
net/netfilter/xt_set.c
··· 372 372 373 373 /* Normalize to fit into jiffies */ 374 374 if (add_opt.ext.timeout != IPSET_NO_TIMEOUT && 375 - add_opt.ext.timeout > UINT_MAX / MSEC_PER_SEC) 376 - add_opt.ext.timeout = UINT_MAX / MSEC_PER_SEC; 375 + add_opt.ext.timeout > IPSET_MAX_TIMEOUT) 376 + add_opt.ext.timeout = IPSET_MAX_TIMEOUT; 377 377 if (info->add_set.index != IPSET_INVALID_ID) 378 378 ip_set_add(info->add_set.index, skb, par, &add_opt); 379 379 if (info->del_set.index != IPSET_INVALID_ID) ··· 407 407 408 408 /* Normalize to fit into jiffies */ 409 409 if (add_opt.ext.timeout != IPSET_NO_TIMEOUT && 410 - add_opt.ext.timeout > UINT_MAX / MSEC_PER_SEC) 411 - add_opt.ext.timeout = UINT_MAX / MSEC_PER_SEC; 410 + add_opt.ext.timeout > IPSET_MAX_TIMEOUT) 411 + add_opt.ext.timeout = IPSET_MAX_TIMEOUT; 412 412 if (info->add_set.index != IPSET_INVALID_ID) 413 413 ip_set_add(info->add_set.index, skb, par, &add_opt); 414 414 if (info->del_set.index != IPSET_INVALID_ID) ··· 470 470 } 471 471 if (((info->flags & IPSET_FLAG_MAP_SKBPRIO) | 472 472 (info->flags & IPSET_FLAG_MAP_SKBQUEUE)) && 473 - !(par->hook_mask & (1 << NF_INET_FORWARD | 473 + (par->hook_mask & ~(1 << NF_INET_FORWARD | 474 474 1 << NF_INET_LOCAL_OUT | 475 475 1 << NF_INET_POST_ROUTING))) { 476 476 pr_info_ratelimited("mapping of prio or/and queue is allowed only from OUTPUT/FORWARD/POSTROUTING chains\n");
+1
net/rds/loop.c
··· 193 193 .inc_copy_to_user = rds_message_inc_copy_to_user, 194 194 .inc_free = rds_loop_inc_free, 195 195 .t_name = "loopback", 196 + .t_type = RDS_TRANS_LOOP, 196 197 };
+5
net/rds/rds.h
··· 479 479 int n_status; 480 480 }; 481 481 482 + /* Available as part of RDS core, so doesn't need to participate 483 + * in get_preferred transport etc 484 + */ 485 + #define RDS_TRANS_LOOP 3 486 + 482 487 /** 483 488 * struct rds_transport - transport specific behavioural hooks 484 489 *
+5
net/rds/recv.c
··· 103 103 rds_stats_add(s_recv_bytes_added_to_socket, delta); 104 104 else 105 105 rds_stats_add(s_recv_bytes_removed_from_socket, -delta); 106 + 107 + /* loop transport doesn't send/recv congestion updates */ 108 + if (rs->rs_transport->t_type == RDS_TRANS_LOOP) 109 + return; 110 + 106 111 now_congested = rs->rs_rcv_bytes > rds_sk_rcvbuf(rs); 107 112 108 113 rdsdebug("rs %p (%pI4:%u) recv bytes %d buf %d "
+18 -10
net/sctp/output.c
··· 409 409 refcount_inc(&sk->sk_wmem_alloc); 410 410 } 411 411 412 + static void sctp_packet_gso_append(struct sk_buff *head, struct sk_buff *skb) 413 + { 414 + if (SCTP_OUTPUT_CB(head)->last == head) 415 + skb_shinfo(head)->frag_list = skb; 416 + else 417 + SCTP_OUTPUT_CB(head)->last->next = skb; 418 + SCTP_OUTPUT_CB(head)->last = skb; 419 + 420 + head->truesize += skb->truesize; 421 + head->data_len += skb->len; 422 + head->len += skb->len; 423 + 424 + __skb_header_release(skb); 425 + } 426 + 412 427 static int sctp_packet_pack(struct sctp_packet *packet, 413 428 struct sk_buff *head, int gso, gfp_t gfp) 414 429 { ··· 437 422 438 423 if (gso) { 439 424 skb_shinfo(head)->gso_type = sk->sk_gso_type; 440 - NAPI_GRO_CB(head)->last = head; 425 + SCTP_OUTPUT_CB(head)->last = head; 441 426 } else { 442 427 nskb = head; 443 428 pkt_size = packet->size; ··· 518 503 &packet->chunk_list); 519 504 } 520 505 521 - if (gso) { 522 - if (skb_gro_receive(&head, nskb)) { 523 - kfree_skb(nskb); 524 - return 0; 525 - } 526 - if (WARN_ON_ONCE(skb_shinfo(head)->gso_segs >= 527 - sk->sk_gso_max_segs)) 528 - return 0; 529 - } 506 + if (gso) 507 + sctp_packet_gso_append(head, nskb); 530 508 531 509 pkt_count++; 532 510 } while (!list_empty(&packet->chunk_list));
+3 -9
net/smc/af_smc.c
··· 1273 1273 return mask; 1274 1274 } 1275 1275 1276 - static __poll_t smc_poll(struct file *file, struct socket *sock, 1277 - poll_table *wait) 1276 + static __poll_t smc_poll_mask(struct socket *sock, __poll_t events) 1278 1277 { 1279 1278 struct sock *sk = sock->sk; 1280 1279 __poll_t mask = 0; ··· 1289 1290 if ((sk->sk_state == SMC_INIT) || smc->use_fallback) { 1290 1291 /* delegate to CLC child sock */ 1291 1292 release_sock(sk); 1292 - mask = smc->clcsock->ops->poll(file, smc->clcsock, wait); 1293 + mask = smc->clcsock->ops->poll_mask(smc->clcsock, events); 1293 1294 lock_sock(sk); 1294 1295 sk->sk_err = smc->clcsock->sk->sk_err; 1295 1296 if (sk->sk_err) { ··· 1307 1308 } 1308 1309 } 1309 1310 } else { 1310 - if (sk->sk_state != SMC_CLOSED) { 1311 - release_sock(sk); 1312 - sock_poll_wait(file, sk_sleep(sk), wait); 1313 - lock_sock(sk); 1314 - } 1315 1311 if (sk->sk_err) 1316 1312 mask |= EPOLLERR; 1317 1313 if ((sk->sk_shutdown == SHUTDOWN_MASK) || ··· 1619 1625 .socketpair = sock_no_socketpair, 1620 1626 .accept = smc_accept, 1621 1627 .getname = smc_getname, 1622 - .poll = smc_poll, 1628 + .poll_mask = smc_poll_mask, 1623 1629 .ioctl = smc_ioctl, 1624 1630 .listen = smc_listen, 1625 1631 .shutdown = smc_shutdown,
+1 -1
net/tls/tls_main.c
··· 712 712 build_protos(tls_prots[TLSV4], &tcp_prot); 713 713 714 714 tls_sw_proto_ops = inet_stream_ops; 715 - tls_sw_proto_ops.poll = tls_sw_poll; 715 + tls_sw_proto_ops.poll_mask = tls_sw_poll_mask; 716 716 tls_sw_proto_ops.splice_read = tls_sw_splice_read; 717 717 718 718 #ifdef CONFIG_TLS_DEVICE
+27 -24
net/tls/tls_sw.c
··· 191 191 } 192 192 193 193 static int tls_do_encryption(struct tls_context *tls_ctx, 194 - struct tls_sw_context_tx *ctx, size_t data_len, 195 - gfp_t flags) 194 + struct tls_sw_context_tx *ctx, 195 + struct aead_request *aead_req, 196 + size_t data_len) 196 197 { 197 - unsigned int req_size = sizeof(struct aead_request) + 198 - crypto_aead_reqsize(ctx->aead_send); 199 - struct aead_request *aead_req; 200 198 int rc; 201 - 202 - aead_req = kzalloc(req_size, flags); 203 - if (!aead_req) 204 - return -ENOMEM; 205 199 206 200 ctx->sg_encrypted_data[0].offset += tls_ctx->tx.prepend_size; 207 201 ctx->sg_encrypted_data[0].length -= tls_ctx->tx.prepend_size; ··· 213 219 ctx->sg_encrypted_data[0].offset -= tls_ctx->tx.prepend_size; 214 220 ctx->sg_encrypted_data[0].length += tls_ctx->tx.prepend_size; 215 221 216 - kfree(aead_req); 217 222 return rc; 218 223 } 219 224 ··· 221 228 { 222 229 struct tls_context *tls_ctx = tls_get_ctx(sk); 223 230 struct tls_sw_context_tx *ctx = tls_sw_ctx_tx(tls_ctx); 231 + struct aead_request *req; 224 232 int rc; 233 + 234 + req = kzalloc(sizeof(struct aead_request) + 235 + crypto_aead_reqsize(ctx->aead_send), sk->sk_allocation); 236 + if (!req) 237 + return -ENOMEM; 225 238 226 239 sg_mark_end(ctx->sg_plaintext_data + ctx->sg_plaintext_num_elem - 1); 227 240 sg_mark_end(ctx->sg_encrypted_data + ctx->sg_encrypted_num_elem - 1); ··· 244 245 tls_ctx->pending_open_record_frags = 0; 245 246 set_bit(TLS_PENDING_CLOSED_RECORD, &tls_ctx->flags); 246 247 247 - rc = tls_do_encryption(tls_ctx, ctx, ctx->sg_plaintext_size, 248 - sk->sk_allocation); 248 + rc = tls_do_encryption(tls_ctx, ctx, req, ctx->sg_plaintext_size); 249 249 if (rc < 0) { 250 250 /* If we are called from write_space and 251 251 * we fail, we need to set this SOCK_NOSPACE 252 252 * to trigger another write_space in the future. 253 253 */ 254 254 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); 255 - return rc; 255 + goto out_req; 256 256 } 257 257 258 258 free_sg(sk, ctx->sg_plaintext_data, &ctx->sg_plaintext_num_elem, ··· 266 268 tls_err_abort(sk, EBADMSG); 267 269 268 270 tls_advance_record_sn(sk, &tls_ctx->tx); 271 + out_req: 272 + kfree(req); 269 273 return rc; 270 274 } 271 275 ··· 754 754 struct sk_buff *skb; 755 755 ssize_t copied = 0; 756 756 bool cmsg = false; 757 - int err = 0; 757 + int target, err = 0; 758 758 long timeo; 759 759 760 760 flags |= nonblock; ··· 764 764 765 765 lock_sock(sk); 766 766 767 + target = sock_rcvlowat(sk, flags & MSG_WAITALL, len); 767 768 timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT); 768 769 do { 769 770 bool zc = false; ··· 857 856 goto recv_end; 858 857 } 859 858 } 859 + /* If we have a new message from strparser, continue now. */ 860 + if (copied >= target && !ctx->recv_pkt) 861 + break; 860 862 } while (len); 861 863 862 864 recv_end: ··· 919 915 return copied ? : err; 920 916 } 921 917 922 - unsigned int tls_sw_poll(struct file *file, struct socket *sock, 923 - struct poll_table_struct *wait) 918 + __poll_t tls_sw_poll_mask(struct socket *sock, __poll_t events) 924 919 { 925 - unsigned int ret; 926 920 struct sock *sk = sock->sk; 927 921 struct tls_context *tls_ctx = tls_get_ctx(sk); 928 922 struct tls_sw_context_rx *ctx = tls_sw_ctx_rx(tls_ctx); 923 + __poll_t mask; 929 924 930 - /* Grab POLLOUT and POLLHUP from the underlying socket */ 931 - ret = ctx->sk_poll(file, sock, wait); 925 + /* Grab EPOLLOUT and EPOLLHUP from the underlying socket */ 926 + mask = ctx->sk_poll_mask(sock, events); 932 927 933 - /* Clear POLLIN bits, and set based on recv_pkt */ 934 - ret &= ~(POLLIN | POLLRDNORM); 928 + /* Clear EPOLLIN bits, and set based on recv_pkt */ 929 + mask &= ~(EPOLLIN | EPOLLRDNORM); 935 930 if (ctx->recv_pkt) 936 - ret |= POLLIN | POLLRDNORM; 931 + mask |= EPOLLIN | EPOLLRDNORM; 937 932 938 - return ret; 933 + return mask; 939 934 } 940 935 941 936 static int tls_read_size(struct strparser *strp, struct sk_buff *skb) ··· 1191 1188 sk->sk_data_ready = tls_data_ready; 1192 1189 write_unlock_bh(&sk->sk_callback_lock); 1193 1190 1194 - sw_ctx_rx->sk_poll = sk->sk_socket->ops->poll; 1191 + sw_ctx_rx->sk_poll_mask = sk->sk_socket->ops->poll_mask; 1195 1192 1196 1193 strp_check_rcv(&sw_ctx_rx->strp); 1197 1194 }
+1
net/wireless/core.c
··· 1012 1012 nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE); 1013 1013 1014 1014 list_del_rcu(&wdev->list); 1015 + synchronize_rcu(); 1015 1016 rdev->devlist_generation++; 1016 1017 1017 1018 switch (wdev->iftype) {
+2
net/wireless/util.c
··· 1746 1746 if (!rdev->ops->get_station) 1747 1747 return -EOPNOTSUPP; 1748 1748 1749 + memset(sinfo, 0, sizeof(*sinfo)); 1750 + 1749 1751 return rdev_get_station(rdev, dev, mac_addr, sinfo); 1750 1752 } 1751 1753 EXPORT_SYMBOL(cfg80211_get_station);
+2 -1
net/xdp/xdp_umem.c
··· 204 204 long npgs; 205 205 int err; 206 206 207 - umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs), GFP_KERNEL); 207 + umem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs), 208 + GFP_KERNEL | __GFP_NOWARN); 208 209 if (!umem->pgs) 209 210 return -ENOMEM; 210 211
+1 -3
tools/testing/selftests/bpf/Makefile
··· 16 16 TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read 17 17 all: $(TEST_CUSTOM_PROGS) 18 18 19 - $(TEST_CUSTOM_PROGS): urandom_read 20 - 21 - urandom_read: urandom_read.c 19 + $(TEST_CUSTOM_PROGS): $(OUTPUT)/%: %.c 22 20 $(CC) -o $(TEST_CUSTOM_PROGS) -static $< -Wl,--build-id 23 21 24 22 # Order correspond to 'make run_tests' order
+1 -1
tools/testing/selftests/tc-testing/tc-tests/actions/ife.json
··· 568 568 "matchPattern": "action order [0-9]*: ife encode action pass.*type 0xED3E.*use tcindex 65535.*index 1", 569 569 "matchCount": "1", 570 570 "teardown": [ 571 - "$TC actions flush action skbedit" 571 + "$TC actions flush action ife" 572 572 ] 573 573 }, 574 574 {