linux-stable/drivers/net
David Arinzon f22bcdd1d1 net: ena: Set tx_info->xdpf value to NULL
[ Upstream commit 36a1ca01f0 ]

The patch mentioned in the `Fixes` tag removed the explicit assignment
of tx_info->xdpf to NULL with the justification that there's no need
to set tx_info->xdpf to NULL and tx_info->num_of_bufs to 0 in case
of a mapping error. Both values won't be used once the mapping function
returns an error, and their values would be overridden by the next
transmitted packet.

While both values do indeed get overridden in the next transmission
call, the value of tx_info->xdpf is also used to check whether a TX
descriptor's transmission has been completed (i.e. a completion for it
was polled).

An example scenario:
1. Mapping failed, tx_info->xdpf wasn't set to NULL
2. A VF reset occurred leading to IO resource destruction and
   a call to ena_free_tx_bufs() function
3. Although the descriptor whose mapping failed was freed by the
   transmission function, it still passes the check
     if (!tx_info->skb)

   (skb and xdp_frame are in a union)
4. The xdp_frame associated with the descriptor is freed twice

This patch returns the assignment of NULL to tx_info->xdpf to make the
cleaning function knows that the descriptor is already freed.

Fixes: 504fd6a539 ("net: ena: fix DMA mapping function issues in XDP")
Signed-off-by: Shay Agroskin <shayagr@amazon.com>
Signed-off-by: David Arinzon <darinzon@amazon.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-04-17 11:23:34 +02:00
..
arcnet net: fill in MODULE_DESCRIPTION()s for missing arcnet 2024-02-15 08:03:46 -08:00
bonding xdp, bonding: Fix feature flags when there are no slave devs anymore 2024-03-05 16:19:42 -08:00
caif
can can: m_can: Start/Cancel polling timer together with interrupts 2024-03-26 18:16:43 -04:00
dsa net: dsa: mt7530: trap link-local frames regardless of ST Port State 2024-04-17 11:23:34 +02:00
ethernet net: ena: Set tx_info->xdpf value to NULL 2024-04-17 11:23:34 +02:00
fddi net: fill in MODULE_DESCRIPTION()s for fddik/skfp 2024-02-15 08:03:46 -08:00
fjes fjes: fix memleaks in fjes_hw_setup 2024-01-24 18:03:53 -08:00
hamradio
hippi
hyperv hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed 2024-02-04 13:38:08 +00:00
ieee802154 net: fill in MODULE_DESCRIPTION()s for ieee802154/fakelb 2024-02-15 08:03:45 -08:00
ipa net: ipa: don't overrun IPA suspend interrupt registers 2024-02-21 11:25:17 +00:00
ipvlan net: fill in MODULE_DESCRIPTION()s for ipvtap 2024-02-09 14:12:02 -08:00
mctp
mdio
netdevsim netdevsim: avoid potential loop in nsim_dev_trap_report_work() 2024-02-02 11:00:38 -08:00
pcs net: pcs: xpcs: Return EINVAL in the internal methods 2024-04-13 13:10:00 +02:00
phy net: phy: phy_device: Prevent nullptr exceptions on ISR 2024-04-13 13:09:57 +02:00
plip net: fill in MODULE_DESCRIPTION()s for plip 2024-02-15 08:03:46 -08:00
ppp net: fill in MODULE_DESCRIPTION()s for ppp 2024-02-15 08:03:46 -08:00
pse-pd
slip
team
thunderbolt
usb net: usb: ax88179_178a: avoid the interface always configured as random address 2024-04-10 16:38:03 +02:00
vmxnet3 vmxnet3: Fix missing reserved tailroom 2024-03-26 18:17:32 -04:00
vxlan net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:09:59 +02:00
wan
wireguard wireguard: netlink: access device through ctx instead of peer 2024-04-03 15:32:26 +02:00
wireless wifi: iwlwifi: Add missing MODULE_FIRMWARE() for *.pnvm 2024-04-13 13:10:01 +02:00
wwan net: wwan: t7xx: Split 64bit accesses to fix alignment issues 2024-04-10 16:37:56 +02:00
xen-netback net: fill in MODULE_DESCRIPTION()s for xen-netback 2024-02-15 08:03:45 -08:00
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c
bareudp.c
dummy.c net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:09:59 +02:00
eql.c
geneve.c geneve: fix header validation in geneve[6]_xmit_skb 2024-04-17 11:23:29 +02:00
gtp.c gtp: fix use-after-free and null-ptr-deref in gtp_newlink() 2024-02-29 14:14:18 +01:00
ifb.c
loopback.c net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:09:59 +02:00
macsec.c Revert "net: macsec: use skb_ensure_writable_head_tail to expand the skb" 2024-01-23 17:17:04 -08:00
macvlan.c
macvtap.c
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
netkit.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c
tun.c tun: Fix xdp_rxq_info's queue_index when detaching 2024-02-23 16:17:41 -08:00
veth.c net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:09:59 +02:00
virtio_net.c virtio_net: Do not send RSS key if it is not supported 2024-04-17 11:23:24 +02:00
vrf.c
vsockmon.c
xen-netfront.c xen-netfront: Add missing skb_mark_for_recycle 2024-04-10 16:38:02 +02:00