linux-stable/drivers/net
Christian Marangi c681989266 net: dsa: qca8k: fix wrong length value for mgmt eth packet
commit 9807ae6974 upstream.

The assumption that Documentation was right about how this value work was
wrong. It was discovered that the length value of the mgmt header is in
step of word size.

As an example to process 4 byte of data the correct length to set is 2.
To process 8 byte 4, 12 byte 6, 16 byte 8...

Odd values will always return the next size on the ack packet.
(length of 3 (6 byte) will always return 8 bytes of data)

This means that a value of 15 (0xf) actually means reading/writing 32 bytes
of data instead of 16 bytes. This behaviour is totally absent and not
documented in the switch Documentation.

In fact from Documentation the max value that mgmt eth can process is
16 byte of data while in reality it can process 32 bytes at once.

To handle this we always round up the length after deviding it for word
size. We check if the result is odd and we round another time to align
to what the switch will provide in the ack packet.
The workaround for the length limit of 15 is still needed as the length
reg max value is 0xf(15)

Reported-by: Ronald Wahl <ronald.wahl@raritan.com>
Tested-by: Ronald Wahl <ronald.wahl@raritan.com>
Fixes: 90386223f4 ("net: dsa: qca8k: add support for larger read/write size with mgmt Ethernet")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Cc: stable@vger.kernel.org # v5.18+
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-12 12:00:46 +01:00
..
appletalk
arcnet arcnet: fix potential memory leak in com20020_probe() 2022-12-02 17:43:08 +01:00
bonding drivers/net/bonding/bond_3ad: return when there's no aggregator 2023-01-12 12:00:40 +01:00
caif
can can: tcan4x5x: Fix use of register error status mask 2022-12-31 13:26:14 +01:00
dsa net: dsa: qca8k: fix wrong length value for mgmt eth packet 2023-01-12 12:00:46 +01:00
ethernet qed: allow sleep in qed_mcp_trace_dump() 2023-01-12 12:00:41 +01:00
fddi net: defxx: Fix missing err handling in dfx_init() 2022-12-31 13:26:12 +01:00
fjes
hamradio hamradio: baycom_epp: Fix return type of baycom_send_packet() 2022-12-31 13:26:43 +01:00
hippi
hyperv
ieee802154 ca8210: Fix crash by zero initializing data 2022-12-14 11:40:56 +01:00
ipa
ipvlan ipvlan: hold lower dev to avoid possible use-after-free 2022-12-02 17:43:04 +01:00
mctp mctp: serial: Fix starting value for frame check sequence 2022-12-31 13:26:39 +01:00
mdio net: mdio: fix unbalanced fwnode reference count in mdio_device_release() 2022-12-14 11:41:03 +01:00
netdevsim netdevsim: Fix memory leak of nsim_dev->fa_cookie 2022-11-26 09:27:40 +01:00
pcs
phy net: phy: xgmiitorgmii: Fix refcount leak in xgmiitorgmii_probe 2023-01-12 12:00:38 +01:00
plip net: plip: don't call kfree_skb/dev_kfree_skb() under spin_lock_irq() 2022-12-14 11:41:05 +01:00
ppp ppp: associate skb with a device at tx 2022-12-31 13:26:45 +01:00
slip
team
usb usb: rndis_host: Secure rndis_query check against int overflow 2023-01-12 12:00:40 +01:00
vmxnet3 vmxnet3: correctly report csum_level for encapsulated packet 2023-01-12 12:00:30 +01:00
vxlan vxlan: Fix memory leaks in error path 2023-01-12 12:00:39 +01:00
wan net: farsync: Fix kmemleak when rmmods farsync 2022-12-31 13:26:13 +01:00
wireguard
wireless wifi: ath9k: use proper statements in conditionals 2023-01-12 12:00:29 +01:00
wwan net: wwan: iosm: fix memory leak in ipc_mux_init() 2022-12-14 11:41:02 +01:00
xen-netback xen/netback: fix build warning 2022-12-14 11:41:04 +01:00
Kconfig
LICENSE.SRC
Makefile
Space.c
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
loopback.c net: loopback: use NET_NAME_PREDICTABLE for name_assign_type 2022-12-21 17:41:15 +01:00
macsec.c net: macsec: fix net device access prior to holding a lock 2022-12-31 13:26:37 +01:00
macvlan.c macvlan: enforce a consistent minimal mtu 2022-11-26 09:27:54 +01:00
macvtap.c
mdio.c
mhi_net.c net: mhi: Fix memory leak in mhi_net_dellink() 2022-11-26 09:27:36 +01:00
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c ntb_netdev: Use dev_kfree_skb_any() in interrupt context 2022-12-31 13:26:14 +01:00
rionet.c
sb1000.c
sungem_phy.c
tap.c
thunderbolt.c net: thunderbolt: fix memory leak in tbnet_open() 2022-12-14 11:41:05 +01:00
tun.c net: tun: Fix use-after-free in tun_detach() 2022-12-08 11:30:18 +01:00
veth.c veth: Fix race with AF_XDP exposing old or uninitialized descriptors 2023-01-12 12:00:31 +01:00
virtio_net.c virtio_net: Fix probe failed when modprobe virtio_net 2022-12-02 17:43:09 +01:00
vrf.c net: vrf: determine the dst using the original ifindex for multicast 2023-01-12 12:00:30 +01:00
vsockmon.c
xen-netfront.c xen-netfront: Fix NULL sring after live migration 2022-12-14 11:41:01 +01:00