kernel_optimize_test/drivers/net
Stephan Gerhold 340fbdc801 virtio_net: fix xdp_rxq_info bug after suspend/resume
[ Upstream commit 8af52fe9fd3bf5e7478da99193c0632276e1dfce ]

The following sequence currently causes a driver bug warning
when using virtio_net:

  # ip link set eth0 up
  # echo mem > /sys/power/state (or e.g. # rtcwake -s 10 -m mem)
  <resume>
  # ip link set eth0 down

  Missing register, driver bug
  WARNING: CPU: 0 PID: 375 at net/core/xdp.c:138 xdp_rxq_info_unreg+0x58/0x60
  Call trace:
   xdp_rxq_info_unreg+0x58/0x60
   virtnet_close+0x58/0xac
   __dev_close_many+0xac/0x140
   __dev_change_flags+0xd8/0x210
   dev_change_flags+0x24/0x64
   do_setlink+0x230/0xdd0
   ...

This happens because virtnet_freeze() frees the receive_queue
completely (including struct xdp_rxq_info) but does not call
xdp_rxq_info_unreg(). Similarly, virtnet_restore() sets up the
receive_queue again but does not call xdp_rxq_info_reg().

Actually, parts of virtnet_freeze_down() and virtnet_restore_up()
are almost identical to virtnet_close() and virtnet_open(): only
the calls to xdp_rxq_info_(un)reg() are missing. This means that
we can fix this easily and avoid such problems in the future by
just calling virtnet_close()/open() from the freeze/restore handlers.

Aside from adding the missing xdp_rxq_info calls the only difference
is that the refill work is only cancelled if netif_running(). However,
this should not make any functional difference since the refill work
should only be active if the network interface is actually up.

Fixes: 754b8a21a9 ("virtio_net: setup xdp_rxq_info")
Signed-off-by: Stephan Gerhold <stephan.gerhold@kernkonzept.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Link: https://lore.kernel.org/r/20220621114845.3650258-1-stephan.gerhold@kernkonzept.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-29 08:59:49 +02:00
..
appletalk
arcnet net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() 2022-03-08 19:09:35 +01:00
bonding bonding: ARP monitor spams NETDEV_NOTIFY_PEERS notifiers 2022-06-29 08:59:47 +02:00
caif
can can: xilinx_can: mark bit timing constants as const 2022-06-09 10:21:14 +02:00
dsa net: dsa: lantiq_gswip: Fix refcount leak in gswip_gphy_fw_list 2022-06-14 18:32:40 +02:00
ethernet igb: Make DMA faster when CPU is active on the PCIe link 2022-06-29 08:59:49 +02:00
fddi
fjes fjes: Check for error irq 2021-12-29 12:25:57 +01:00
hamradio hamradio: remove needs_free_netdev to avoid UAF 2022-04-20 09:23:09 +02:00
hippi drivers: net: hippi: Fix deadlock in rr_close() 2022-05-09 09:05:06 +02:00
hyperv hv_netvsc: Fix potential dereference of NULL pointer 2022-06-09 10:21:12 +02:00
ieee802154 net: ieee802154: ca8210: Fix lifs/sifs periods 2022-02-23 12:01:02 +01:00
ipa net: ipa: fix page free in ipa_endpoint_replenish_one() 2022-06-09 10:21:29 +02:00
ipvlan
mdio net: mdio: Alphabetically sort header inclusion 2022-04-20 09:23:12 +02:00
netdevsim netdevsim: Zero-initialize memory for new map's value in function nsim_bpf_map_alloc 2021-12-22 09:30:55 +01:00
pcs
phy phy: aquantia: Fix AN when higher speeds than 1G are not advertised 2022-06-29 08:59:47 +02:00
plip
ppp ppp: ensure minimum packet size in ppp_write() 2022-01-27 10:54:01 +01:00
slip drivers: net: slip: fix NPD bug in sl_tx_timeout() 2022-04-20 09:23:24 +02:00
team
usb net: usb: aqc111: Fix out-of-bounds accesses in RX fixup 2022-04-20 09:23:23 +02:00
vmxnet3 net: vmxnet3: fix possible NULL pointer dereference in vmxnet3_rq_cleanup() 2022-05-25 09:17:58 +02:00
wan
wimax
wireguard lsm,selinux: pass flowi_common instead of flowi to the LSM hooks 2022-06-09 10:21:09 +02:00
wireless carl9170: tx: fix an incorrect use of list iterator 2022-06-09 10:21:27 +02:00
xen-netback Revert "xen-netback: Check for hotplug-status existence before watching" 2022-03-16 14:16:00 +01:00
bareudp.c bareudp: use ipv6_mod_enabled to check if IPv6 enabled 2022-04-08 14:40:22 +02:00
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
Kconfig lib/crypto: blake2s: include as built-in 2022-05-30 09:33:26 +02:00
LICENSE.SRC
loopback.c
macsec.c net: macsec: Verify that send_sci is on when setting Tx sci explicitly 2022-02-08 18:30:38 +01:00
macvlan.c
macvtap.c macvtap: advertise link netns via netlink 2022-04-13 21:00:59 +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
tap.c tuntap: add sanity checks about msg_controllen in sendmsg 2022-04-13 21:00:59 +02:00
thunderbolt.c
tun.c tuntap: add sanity checks about msg_controllen in sendmsg 2022-04-13 21:00:59 +02:00
veth.c veth: Ensure eth header is in skb's linear part 2022-04-20 09:23:11 +02:00
virtio_net.c virtio_net: fix xdp_rxq_info bug after suspend/resume 2022-06-29 08:59:49 +02:00
vrf.c vrf: don't run conntrack on vrf with !dflt qdisc 2021-12-14 11:32:36 +01:00
vsockmon.c
vxlan.c vxlan: fix error return code in vxlan_fdb_append 2022-04-27 13:53:53 +02:00
xen-netfront.c xen/netfront: react properly to failing gnttab_end_foreign_access_ref() 2022-03-11 12:11:55 +01:00