kernel_samsung_a53x/drivers/net
Gustavo A. R. Silva 946d0edf40 octeontx2-pf: Fix out-of-bounds read in otx2_get_fecparam()
commit 93efb0c656837f4a31d7cc6117a7c8cecc8fadac upstream.

Code at line 967 implies that rsp->fwdata.supported_fec may be up to 4:

 967: if (rsp->fwdata.supported_fec <= FEC_MAX_INDEX)

If rsp->fwdata.supported_fec evaluates to 4, then there is an
out-of-bounds read at line 971 because fec is an array with
a maximum of 4 elements:

 954         const int fec[] = {
 955                 ETHTOOL_FEC_OFF,
 956                 ETHTOOL_FEC_BASER,
 957                 ETHTOOL_FEC_RS,
 958                 ETHTOOL_FEC_BASER | ETHTOOL_FEC_RS};
 959 #define FEC_MAX_INDEX 4

 971: fecparam->fec = fec[rsp->fwdata.supported_fec];

Fix this by properly indexing fec[] with rsp->fwdata.supported_fec - 1.
In this case the proper indexes 0 to 3 are used when
rsp->fwdata.supported_fec evaluates to a range of 1 to 4, correspondingly.

Fixes: d0cf9503e908 ("octeontx2-pf: ethtool fec mode support")
Addresses-Coverity-ID: 1501722 ("Out-of-bounds read")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-17 13:24:23 +01:00
..
appletalk
arcnet
bonding Revert "net: bonding: correctly annotate RCU in bond_should_notify_peers()" 2024-11-24 00:23:56 +01:00
caif
can can: c_can: fix {rx,tx}_errors statistics 2024-11-30 02:33:22 +01:00
dropdump
dsa Revert "net: dsa: mv88e6xxx: Limit chip-wide frame size config to CPU ports" 2024-11-24 00:23:56 +01:00
ethernet octeontx2-pf: Fix out-of-bounds read in otx2_get_fecparam() 2024-12-17 13:24:23 +01:00
fddi
fjes
hamradio
hippi
hyperv hv_netvsc: Fix VF namespace also in synthetic NIC NETDEV_REGISTER event 2024-11-23 23:22:01 +01:00
ieee802154 Revert "ieee802154: Fix build error" 2024-11-24 00:23:12 +01:00
ipa
ipvlan
mdio
netdevsim netdevsim: copy addresses for both in and out paths 2024-12-17 13:24:04 +01:00
pcs
phy net: phy: ti: take into account all possible interrupt sources 2024-11-30 02:33:27 +01:00
plip
ppp Revert "ppp: fix ppp_async_encode() illegal access" 2024-11-24 00:22:56 +01:00
slip Revert "slip: make slhc_remember() more robust against malicious packets" 2024-11-24 00:22:55 +01:00
team
usb net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration 2024-12-17 13:24:15 +01:00
vmxnet3
vxlan
wan
wimax
wireguard
wireless wifi: mwifiex: Fix memcpy() field-spanning write warning in mwifiex_config_scan() 2024-12-17 13:24:05 +01:00
xen-netback Revert "net/xen-netback: prevent UAF in xenvif_flush_hash()" 2024-11-24 00:23:10 +01:00
bareudp.c Revert "bareudp: Fix device stats updates." 2024-11-24 00:23:41 +01:00
dummy.c
eql.c
geneve.c Revert "gro: remove rcu_read_lock/rcu_read_unlock from gro_receive handlers" 2024-11-24 00:23:41 +01:00
gtp.c Revert "gtp: fix a potential NULL pointer dereference" 2024-11-24 00:23:49 +01:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
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
thunderbolt.c
tun.c
veth.c
virtio_net.c Revert "virtio_net: Fix napi_skb_cache_put warning" 2024-11-24 00:23:46 +01:00
vrf.c Revert "net: vrf: determine the dst using the original ifindex for multicast" 2024-11-24 00:22:54 +01:00
vsockmon.c
xen-netfront.c