OpenCloudOS-Kernel/drivers/net/ethernet/stmicro/stmmac
Camel Guo 7af037c39b net: stmmac: dump gmac4 DMA registers correctly
Unlike gmac100, gmac1000, gmac4 has 27 DMA registers and they are
located at DMA_CHAN_BASE_ADDR (0x1100). In order for ethtool to dump
gmac4 DMA registers correctly, this commit checks if a net_device has
gmac4 and uses different logic to dump its DMA registers.

This fixes the following KASAN warning, which can normally be triggered
by a command similar like "ethtool -d eth0":

BUG: KASAN: vmalloc-out-of-bounds in dwmac4_dump_dma_regs+0x6d4/0xb30
Write of size 4 at addr ffffffc010177100 by task ethtool/1839
 kasan_report+0x200/0x21c
 __asan_report_store4_noabort+0x34/0x60
 dwmac4_dump_dma_regs+0x6d4/0xb30
 stmmac_ethtool_gregs+0x110/0x204
 ethtool_get_regs+0x200/0x4b0
 dev_ethtool+0x1dac/0x3800
 dev_ioctl+0x7c0/0xb50
 sock_ioctl+0x298/0x6c4
 ...

Fixes: fbf68229ff ("net: stmmac: unify registers dumps methods")
Signed-off-by: Camel Guo <camelg@axis.com>
Link: https://lore.kernel.org/r/20220131083841.3346801-1-camel.guo@axis.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-01-31 21:21:10 -08:00
..
Kconfig ethernet: fix PTP_1588_CLOCK dependencies 2021-08-13 17:49:05 -07:00
Makefile stmmac: pci: Add dwmac support for Loongson 2021-06-18 11:48:34 -07:00
altr_tse_pcs.c
altr_tse_pcs.h
chain_mode.c net: stmmac: Add support to Ethtool get/set ring parameters 2020-09-16 15:22:52 -07:00
common.h net: stmmac: bump tc when get underflow error from DMA descriptor 2021-12-13 12:20:35 +00:00
descs.h
descs_com.h
dwmac-anarion.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-dwc-qos-eth.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-generic.c net: stmmac: add support for dwmac 3.40a 2021-10-08 16:22:39 +01:00
dwmac-imx.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-ingenic.c net: stmmac: Fix error return code in ingenic_mac_probe() 2021-06-16 12:02:38 -07:00
dwmac-intel-plat.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-intel.c stmmac: intel: set PCI_D3hot in suspend 2021-06-29 11:34:48 -07:00
dwmac-intel.h stmmac: intel: move definitions to dwmac-intel header file 2021-06-12 13:10:52 -07:00
dwmac-ipq806x.c net: ethernet: stmmac: Do not use unreachable() in ipq806x_gmac_probe() 2021-08-07 09:45:46 +01:00
dwmac-loongson.c stmmac: dwmac-loongson:Fix missing return value 2021-09-06 12:52:52 +01:00
dwmac-lpc18xx.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-mediatek.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-meson.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-meson8b.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-oxnas.c net: stmmac: dwmac-oxnas: Add support for OX810SE 2022-01-12 09:05:02 -08:00
dwmac-qcom-ethqos.c net: stmmac: Add platform level debug register dump feature 2021-11-30 11:57:58 +00:00
dwmac-rk.c net: stmmac: dwmac-rk: fix oob read in rk_gmac_setup 2021-12-16 10:47:48 +00:00
dwmac-socfpga.c net: stmmac: socfpga: add runtime suspend/resume callback for stratix10 platform 2021-11-15 14:20:42 +00:00
dwmac-sti.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-stm32.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
dwmac-sun8i.c net: stmmac: dwmac-sun8i: use return val of readl_poll_timeout() 2022-01-27 13:51:10 +00:00
dwmac-sunxi.c net: stmicro: handle clk_prepare() failure during init 2021-05-13 17:33:18 +02:00
dwmac-visconti.c net: stmmac: dwmac-visconti: No change to ETHER_CLOCK_SEL for unexpected speed request. 2022-01-28 14:28:30 +00:00
dwmac4.h net: stmmac: Add hardware supported cross-timestamp 2021-03-24 15:12:36 -07:00
dwmac4_core.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
dwmac4_descs.c net: stmmac: bump tc when get underflow error from DMA descriptor 2021-12-13 12:20:35 +00:00
dwmac4_descs.h
dwmac4_dma.c net: stmmac: fix get_hw_feature() on old hardware 2021-10-08 16:22:38 +01:00
dwmac4_dma.h net: stmmac: Add HW descriptor prefetch setting for DWMAC Core 5.20 onwards 2021-04-22 15:02:40 -07:00
dwmac4_lib.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
dwmac5.c net: stmmac: enable platform specific safety features 2021-06-01 16:59:50 -07:00
dwmac5.h net: stmmac: enable platform specific safety features 2021-06-01 16:59:50 -07:00
dwmac100.h
dwmac100_core.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
dwmac100_dma.c
dwmac1000.h net: stmmac: dwmac1000: Fix extended MAC address registers definition 2021-06-11 13:05:55 -07:00
dwmac1000_core.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
dwmac1000_dma.c net: stmmac: fix get_hw_feature() on old hardware 2021-10-08 16:22:38 +01:00
dwmac_dma.h net: stmmac: dump gmac4 DMA registers correctly 2022-01-31 21:21:10 -08:00
dwmac_lib.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
dwxgmac2.h net: stmmac: introduce DMA interrupt status masking per traffic direction 2021-03-25 17:37:30 -07:00
dwxgmac2_core.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
dwxgmac2_descs.c net: stmmac: fix wrongly set buffer2 valid when sph unsupport 2021-02-26 15:17:11 -08:00
dwxgmac2_dma.c net: stmmac: fix get_hw_feature() on old hardware 2021-10-08 16:22:38 +01:00
dwxlgmac2.h
enh_desc.c net: stmmac: fix dma physical address of descriptor when display ring 2021-02-26 15:17:11 -08:00
hwif.c
hwif.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-10-14 16:50:14 -07:00
mmc.h
mmc_core.c
norm_desc.c net: stmmac: fix dma physical address of descriptor when display ring 2021-02-26 15:17:11 -08:00
ring_mode.c net: stmmac: Add support to Ethtool get/set ring parameters 2020-09-16 15:22:52 -07:00
stmmac.h net: stmmac: remove unused members in struct stmmac_priv 2022-01-24 13:31:45 +00:00
stmmac_ethtool.c net: stmmac: dump gmac4 DMA registers correctly 2022-01-31 21:21:10 -08:00
stmmac_hwtstamp.c net: stmmac: Add support for external trigger timestamping 2021-04-14 12:57:45 -07:00
stmmac_main.c net: stmmac: properly handle with runtime pm in stmmac_dvr_remove() 2022-01-28 15:13:22 +00:00
stmmac_mdio.c net: stmmac: reverse Christmas tree notation in stmmac_xpcs_setup 2021-06-11 13:43:55 -07:00
stmmac_pci.c net: stmmac: enable platform specific safety features 2021-06-01 16:59:50 -07:00
stmmac_pcs.h
stmmac_platform.c net: stmmac: retain PTP clock time during SIOCSHWTSTAMP ioctls 2021-11-22 14:29:26 +00:00
stmmac_platform.h of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
stmmac_ptp.c net: stmmac: configure PTP clock source prior to PTP initialization 2022-01-27 13:45:56 +00:00
stmmac_ptp.h net: stmmac: Add support for external trigger timestamping 2021-04-14 12:57:45 -07:00
stmmac_selftests.c ethernet: constify references to netdev->dev_addr in drivers 2021-10-14 09:22:11 -07:00
stmmac_tc.c net: stmmac: add tc flower filter for EtherType matching 2021-12-23 11:20:49 +00:00
stmmac_xdp.c net: stmmac: enhance XDP ZC driver level switching performance 2021-11-15 12:56:34 +00:00
stmmac_xdp.h net: stmmac: Enable RX via AF_XDP zero-copy 2021-04-13 15:06:51 -07:00