1
0
Fork 0
alistair23-linux/drivers/net
Guilherme G. Piccoli a2a3baa299 net: ena: Add PCI shutdown handler to allow safe kexec
[ Upstream commit 428c491332 ]

Currently ENA only provides the PCI remove() handler, used during rmmod
for example. This is not called on shutdown/kexec path; we are potentially
creating a failure scenario on kexec:

(a) Kexec is triggered, no shutdown() / remove() handler is called for ENA;
instead pci_device_shutdown() clears the master bit of the PCI device,
stopping all DMA transactions;

(b) Kexec reboot happens and the device gets enabled again, likely having
its FW with that DMA transaction buffered; then it may trigger the (now
invalid) memory operation in the new kernel, corrupting kernel memory area.

This patch aims to prevent this, by implementing a shutdown() handler
quite similar to the remove() one - the difference being the handling
of the netdev, which is unregistered on remove(), but following the
convention observed in other drivers, it's only detached on shutdown().

This prevents an odd issue in AWS Nitro instances, in which after the 2nd
kexec the next one will fail with an initrd corruption, caused by a wild
DMA write to invalid kernel memory. The lspci output for the adapter
present in my instance is:

00:05.0 Ethernet controller [0200]: Amazon.com, Inc. Elastic Network
Adapter (ENA) [1d0f:ec20]

Suggested-by: Gavin Shan <gshan@redhat.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@canonical.com>
Acked-by: Sameeh Jubran <sameehj@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-01 11:01:34 +02:00
..
appletalk
arcnet drivers: net: Fix Kconfig indentation 2019-09-26 08:56:17 +02:00
bonding bonding/alb: make sure arp header is pulled before accessing it 2020-03-18 07:17:42 +01:00
caif
can can: add missing attribute validation for termination 2020-03-18 07:17:44 +01:00
dsa net: dsa: mt7530: Change the LINK bit to reflect the link status 2020-04-01 11:01:33 +02:00
ethernet net: ena: Add PCI shutdown handler to allow safe kexec 2020-04-01 11:01:34 +02:00
fddi
fjes fjes: fix missed check in fjes_acpi_add 2019-12-31 16:41:14 +01:00
hamradio 6pack,mkiss: fix possible deadlock 2020-01-04 19:18:36 +01:00
hippi
hyperv hv_netvsc: Fix unwanted wakeup in netvsc_attach() 2020-03-05 16:43:46 +01:00
ieee802154 Merge tag 'ieee802154-for-davem-2019-09-28' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan 2019-09-30 17:14:45 -07:00
ipvlan ipvlan: don't deref eth hdr before checking it's set 2020-03-18 07:17:39 +01:00
netdevsim netdevsim: fix stack-out-of-bounds in nsim_dev_debugfs_init() 2020-02-11 04:35:06 -08:00
phy net: phy: mscc: fix firmware paths 2020-03-21 08:11:53 +01:00
plip
ppp ppp: Adjust indentation into ppp_async_input 2020-02-11 04:35:46 -08:00
slip slip: not call free_netdev before rtnl_unlock in slip_open 2020-03-21 08:11:53 +01:00
team team: add missing attribute validation for array index 2020-03-18 07:17:45 +01:00
usb net: usb: qmi_wwan: restore mtu min/max values after raw_ip switch 2020-03-21 08:11:50 +01:00
vmxnet3
wan wan: ixp4xx_hss: fix compile-testing on 64-bit 2020-02-24 08:36:46 +01:00
wimax wimax: i2400: Fix memory leak in i2400m_op_rfkill_sw_toggle 2019-10-29 16:20:25 -07:00
wireless mt76: fix array overflow on receiving too many fragments for a packet 2020-03-18 07:17:53 +01:00
xen-netback xen/netback: fix error path of xenvif_connect_data() 2019-10-19 11:43:29 -07:00
Kconfig drivers: net: Fix Kconfig indentation 2019-09-26 08:56:17 +02:00
LICENSE.SRC
Makefile
Space.c
dummy.c
eql.c
geneve.c geneve: move debug check after netdev unregister 2020-04-01 11:01:31 +02:00
gtp.c gtp: use __GFP_NOWARN to avoid memalloc warning 2020-02-11 04:35:04 -08:00
ifb.c
loopback.c
macsec.c macsec: restrict to ethernet devices 2020-04-01 11:01:32 +02:00
macvlan.c macvlan: add cond_resched() during multicast processing 2020-03-18 07:17:39 +01:00
macvtap.c
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c net: tap: clean up an indentation issue 2019-09-27 20:58:35 +02:00
thunderbolt.c
tun.c tun: add mutex_unlock() call and napi.skb clearing in tun_get_user() 2020-01-29 16:45:22 +01:00
veth.c
virtio_net.c netfilter: drop bridge nf reset from nf_reset 2019-10-01 18:42:15 +02:00
vrf.c net: core: add generic lockdep keys 2019-10-24 14:53:48 -07:00
vsockmon.c
vxlan.c vxlan: fix tos value before xmit 2020-01-12 12:21:49 +01:00
xen-netfront.c xen-netfront: do not use ~0U as error return value for xennet_fill_frags() 2019-10-01 21:49:51 -04:00