android_kernel_motorola_sm6375/drivers/net
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Lin Ma 55197ba6d6 igb: Add lock to avoid data race
commit 6faee3d4ee8be0f0367d0c3d826afb3571b7a5e0 upstream.

The commit c23d92b80e ("igb: Teardown SR-IOV before
unregister_netdev()") places the unregister_netdev() call after the
igb_disable_sriov() call to avoid functionality issue.

However, it introduces several race conditions when detaching a device.
For example, when .remove() is called, the below interleaving leads to
use-after-free.

 (FREE from device detaching)      |   (USE from netdev core)
igb_remove                         |  igb_ndo_get_vf_config
 igb_disable_sriov                 |  vf >= adapter->vfs_allocated_count?
  kfree(adapter->vf_data)          |
  adapter->vfs_allocated_count = 0 |
                                   |    memcpy(... adapter->vf_data[vf]

Moreover, the igb_disable_sriov() also suffers from data race with the
requests from VF driver.

 (FREE from device detaching)      |   (USE from requests)
igb_remove                         |  igb_msix_other
 igb_disable_sriov                 |   igb_msg_task
  kfree(adapter->vf_data)          |    vf < adapter->vfs_allocated_count
  adapter->vfs_allocated_count = 0 |

To this end, this commit first eliminates the data races from netdev
core by using rtnl_lock (similar to commit 719479230893 ("dpaa2-eth: add
MAC/PHY support through phylink")). And then adds a spinlock to
eliminate races from driver requests. (similar to commit 1e53834ce541
("ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero")

Fixes: c23d92b80e ("igb: Teardown SR-IOV before unregister_netdev()")
Signed-off-by: Lin Ma <[email protected]>
Tested-by: Konrad Jankowski <[email protected]>
Signed-off-by: Tony Nguyen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-08-25 11:18:30 +02:00
..
appletalk
arcnet net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() 2022-03-08 19:07:48 +01:00
bonding net: bonding: fix use-after-free after 802.3ad slave unbind 2022-07-07 17:36:50 +02:00
caif caif_virtio: fix race between virtio_device_ready() and ndo_open() 2022-07-07 17:36:49 +02:00
can can: mcp251x: Fix race condition on receive interrupt 2022-08-25 11:18:22 +02:00
dsa net: dsa: microchip: ksz9477: fix fdb_dump last invalid entry 2022-08-25 11:18:30 +02:00
ethernet igb: Add lock to avoid data race 2022-08-25 11:18:30 +02:00
fddi
fjes
hamradio hamradio: remove needs_free_netdev to avoid UAF 2022-05-09 09:03:20 +02:00
hippi drivers: net: hippi: Fix deadlock in rr_close() 2022-05-09 09:03:27 +02:00
hyperv hv_netvsc: Add check for kvmalloc_array 2022-03-23 09:12:07 +01:00
ieee802154 net: ieee802154: ca8210: Fix lifs/sifs periods 2022-02-23 11:59:58 +01:00
ipvlan
netdevsim netdevsim: Avoid allocation warnings triggered from user space 2022-08-25 11:17:49 +02:00
phy net: sfp: fix memory leak in sfp_probe() 2022-07-21 20:59:25 +02:00
plip plip: avoid rcu debug splat 2022-08-25 11:18:24 +02:00
ppp
slip drivers: net: slip: fix NPD bug in sl_tx_timeout() 2022-04-20 09:19:37 +02:00
team
usb Revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP" 2022-08-25 11:18:17 +02:00
vmxnet3 net: vmxnet3: fix possible NULL pointer dereference in vmxnet3_rq_cleanup() 2022-05-25 09:14:35 +02:00
wan
wimax
wireless wifi: libertas: Fix possible refcount leak in if_usb_probe() 2022-08-25 11:17:48 +02:00
xen-netback xen/netback: avoid entering xenvif_rx_next_skb() with an empty rx queue 2022-07-21 20:59:16 +02:00
dummy.c
eql.c
geneve.c geneve: do not use RT_TOS for IPv6 flowlabel 2022-08-25 11:18:24 +02:00
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c net: macsec: Verify that send_sci is on when setting Tx sci explicitly 2022-02-08 18:24:31 +01:00
macvlan.c
macvtap.c macvtap: advertise link netns via netlink 2022-04-15 14:18:34 +02:00
Makefile
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c net: sungem_phy: Add of_node_put() for reference returned by of_get_parent() 2022-08-03 11:59:39 +02:00
tap.c tuntap: add sanity checks about msg_controllen in sendmsg 2022-04-15 14:18:34 +02:00
thunderbolt.c
tun.c net: tun: avoid disabling NAPI twice 2022-07-07 17:36:50 +02:00
veth.c veth: Ensure eth header is in skb's linear part 2022-04-20 09:19:34 +02:00
virtio_net.c virtio-net: fix the race between refill work and close 2022-08-03 11:59:41 +02:00
vrf.c
vsockmon.c
vxlan.c vxlan: fix error return code in vxlan_fdb_append 2022-04-27 13:50:47 +02:00
xen-netfront.c xen/netfront: force data bouncing when backend is untrusted 2022-07-07 17:36:53 +02:00