linux-stable/drivers/net
David Arinzon 2fc4d53ff0 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:19:32 +02:00
..
appletalk
arcnet
bonding xdp, bonding: Fix feature flags when there are no slave devs anymore 2024-03-15 10:48:18 -04:00
caif
can can: m_can: Start/Cancel polling timer together with interrupts 2024-03-26 18:19:29 -04:00
dsa net: dsa: mt7530: trap link-local frames regardless of ST Port State 2024-04-17 11:19:31 +02:00
ethernet net: ena: Set tx_info->xdpf value to NULL 2024-04-17 11:19:32 +02:00
fddi
fjes fjes: fix memleaks in fjes_hw_setup 2024-01-31 16:19:05 -08:00
hamradio
hippi
hyperv hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed 2024-02-23 09:25:16 +01:00
ieee802154
ipa net: ipa: don't overrun IPA suspend interrupt registers 2024-03-01 13:35:08 +01:00
ipvlan
mctp
mdio
netdevsim netdevsim: avoid potential loop in nsim_dev_trap_report_work() 2024-02-16 19:10:47 +01:00
pcs net: pcs: xpcs: Return EINVAL in the internal methods 2024-04-13 13:07:31 +02:00
phy net: phy: phy_device: Prevent nullptr exceptions on ISR 2024-04-13 13:07:29 +02:00
plip
ppp ppp_async: limit MRU to 64K 2024-02-16 19:10:50 +01:00
pse-pd
slip
team team: Fix use-after-free when an option instance allocation fails 2023-12-20 17:02:02 +01:00
thunderbolt
usb net: usb: ax88179_178a: avoid the interface always configured as random address 2024-04-10 16:35:49 +02:00
vmxnet3 vmxnet3: Fix missing reserved tailroom 2024-03-26 18:20:08 -04:00
vxlan net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:07:30 +02:00
wan
wireguard wireguard: netlink: access device through ctx instead of peer 2024-04-03 15:28:36 +02:00
wireless wifi: iwlwifi: Add missing MODULE_FIRMWARE() for *.pnvm 2024-04-13 13:07:32 +02:00
wwan net: wwan: t7xx: Split 64bit accesses to fix alignment issues 2024-04-10 16:35:42 +02:00
xen-netback xen-netback: properly sync TX responses 2024-02-23 09:25:03 +01:00
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c amt: do not use overwrapped cb area 2024-01-25 15:35:56 -08:00
bareudp.c
dummy.c net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:07:30 +02:00
eql.c
geneve.c geneve: fix header validation in geneve[6]_xmit_skb 2024-04-17 11:19:28 +02:00
gtp.c gtp: fix use-after-free and null-ptr-deref in gtp_newlink() 2024-03-06 14:48:39 +00:00
ifb.c
loopback.c net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:07:30 +02:00
macsec.c
macvlan.c
macvtap.c
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.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-03-06 14:48:34 +00:00
veth.c net: add netdev_lockdep_set_classes() to virtual drivers 2024-04-13 13:07:30 +02:00
virtio_net.c virtio_net: Fix "‘%d’ directive writing between 1 and 11 bytes into a region of size 10" warnings 2024-02-05 20:14:33 +00:00
vrf.c
vsockmon.c
xen-netfront.c xen-netfront: Add missing skb_mark_for_recycle 2024-04-10 16:35:49 +02:00