From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Juergen Borleis <jbe@pengutronix.de>,
Andrew Lunn <andrew@lunn.ch>, Jakub Kicinski <kuba@kernel.org>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 75/91] net: fec: limit register access on i.MX6UL
Date: Wed, 2 Nov 2022 03:33:58 +0100 [thread overview]
Message-ID: <20221102022057.177463393@linuxfoundation.org> (raw)
In-Reply-To: <20221102022055.039689234@linuxfoundation.org>
From: Juergen Borleis <jbe@pengutronix.de>
[ Upstream commit 0a8b43b12dd78daa77a7dc007b92770d262a2714 ]
Using 'ethtool -d […]' on an i.MX6UL leads to a kernel crash:
Unhandled fault: external abort on non-linefetch (0x1008) at […]
due to this SoC has less registers in its FEC implementation compared to other
i.MX6 variants. Thus, a run-time decision is required to avoid access to
non-existing registers.
Fixes: a51d3ab50702 ("net: fec: use a more proper compatible string for i.MX6UL type device")
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20221024080552.21004-1-jbe@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/freescale/fec_main.c | 46 ++++++++++++++++++++++-
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d8bdaf2e5365..e183caf38176 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2251,6 +2251,31 @@ static u32 fec_enet_register_offset[] = {
IEEE_R_DROP, IEEE_R_FRAME_OK, IEEE_R_CRC, IEEE_R_ALIGN, IEEE_R_MACERR,
IEEE_R_FDXFC, IEEE_R_OCTETS_OK
};
+/* for i.MX6ul */
+static u32 fec_enet_register_offset_6ul[] = {
+ FEC_IEVENT, FEC_IMASK, FEC_R_DES_ACTIVE_0, FEC_X_DES_ACTIVE_0,
+ FEC_ECNTRL, FEC_MII_DATA, FEC_MII_SPEED, FEC_MIB_CTRLSTAT, FEC_R_CNTRL,
+ FEC_X_CNTRL, FEC_ADDR_LOW, FEC_ADDR_HIGH, FEC_OPD, FEC_TXIC0, FEC_RXIC0,
+ FEC_HASH_TABLE_HIGH, FEC_HASH_TABLE_LOW, FEC_GRP_HASH_TABLE_HIGH,
+ FEC_GRP_HASH_TABLE_LOW, FEC_X_WMRK, FEC_R_DES_START_0,
+ FEC_X_DES_START_0, FEC_R_BUFF_SIZE_0, FEC_R_FIFO_RSFL, FEC_R_FIFO_RSEM,
+ FEC_R_FIFO_RAEM, FEC_R_FIFO_RAFL, FEC_RACC,
+ RMON_T_DROP, RMON_T_PACKETS, RMON_T_BC_PKT, RMON_T_MC_PKT,
+ RMON_T_CRC_ALIGN, RMON_T_UNDERSIZE, RMON_T_OVERSIZE, RMON_T_FRAG,
+ RMON_T_JAB, RMON_T_COL, RMON_T_P64, RMON_T_P65TO127, RMON_T_P128TO255,
+ RMON_T_P256TO511, RMON_T_P512TO1023, RMON_T_P1024TO2047,
+ RMON_T_P_GTE2048, RMON_T_OCTETS,
+ IEEE_T_DROP, IEEE_T_FRAME_OK, IEEE_T_1COL, IEEE_T_MCOL, IEEE_T_DEF,
+ IEEE_T_LCOL, IEEE_T_EXCOL, IEEE_T_MACERR, IEEE_T_CSERR, IEEE_T_SQE,
+ IEEE_T_FDXFC, IEEE_T_OCTETS_OK,
+ RMON_R_PACKETS, RMON_R_BC_PKT, RMON_R_MC_PKT, RMON_R_CRC_ALIGN,
+ RMON_R_UNDERSIZE, RMON_R_OVERSIZE, RMON_R_FRAG, RMON_R_JAB,
+ RMON_R_RESVD_O, RMON_R_P64, RMON_R_P65TO127, RMON_R_P128TO255,
+ RMON_R_P256TO511, RMON_R_P512TO1023, RMON_R_P1024TO2047,
+ RMON_R_P_GTE2048, RMON_R_OCTETS,
+ IEEE_R_DROP, IEEE_R_FRAME_OK, IEEE_R_CRC, IEEE_R_ALIGN, IEEE_R_MACERR,
+ IEEE_R_FDXFC, IEEE_R_OCTETS_OK
+};
#else
static __u32 fec_enet_register_version = 1;
static u32 fec_enet_register_offset[] = {
@@ -2275,7 +2300,24 @@ static void fec_enet_get_regs(struct net_device *ndev,
u32 *buf = (u32 *)regbuf;
u32 i, off;
int ret;
+#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
+ defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARM) || \
+ defined(CONFIG_ARM64) || defined(CONFIG_COMPILE_TEST)
+ u32 *reg_list;
+ u32 reg_cnt;
+ if (!of_machine_is_compatible("fsl,imx6ul")) {
+ reg_list = fec_enet_register_offset;
+ reg_cnt = ARRAY_SIZE(fec_enet_register_offset);
+ } else {
+ reg_list = fec_enet_register_offset_6ul;
+ reg_cnt = ARRAY_SIZE(fec_enet_register_offset_6ul);
+ }
+#else
+ /* coldfire */
+ static u32 *reg_list = fec_enet_register_offset;
+ static const u32 reg_cnt = ARRAY_SIZE(fec_enet_register_offset);
+#endif
ret = pm_runtime_resume_and_get(dev);
if (ret < 0)
return;
@@ -2284,8 +2326,8 @@ static void fec_enet_get_regs(struct net_device *ndev,
memset(buf, 0, regs->len);
- for (i = 0; i < ARRAY_SIZE(fec_enet_register_offset); i++) {
- off = fec_enet_register_offset[i];
+ for (i = 0; i < reg_cnt; i++) {
+ off = reg_list[i];
if ((off == FEC_R_BOUND || off == FEC_R_FSTART) &&
!(fep->quirks & FEC_QUIRK_HAS_FRREG))
--
2.35.1
next prev parent reply other threads:[~2022-11-02 3:18 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-02 2:32 [PATCH 5.10 00/91] 5.10.153-rc1 review Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 01/91] can: j1939: transport: j1939_session_skb_drop_old(): spin_unlock_irqrestore() before kfree_skb() Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 02/91] can: kvaser_usb: Fix possible completions during init_completion Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 03/91] ALSA: Use del_timer_sync() before freeing timer Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 04/91] ALSA: au88x0: use explicitly signed char Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 05/91] ALSA: rme9652: " Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 06/91] USB: add RESET_RESUME quirk for NVIDIA Jetson devices in RCM Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 07/91] usb: dwc3: gadget: Stop processing more requests on IMI Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 08/91] usb: dwc3: gadget: Dont set IMI for no_interrupt Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 09/91] usb: bdc: change state when port disconnected Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 10/91] usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 11/91] mtd: rawnand: marvell: Use correct logic for nand-keep-config Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 12/91] xhci: Add quirk to reset host back to default state at shutdown Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 13/91] xhci: Remove device endpoints from bandwidth list when freeing the device Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 14/91] tools: iio: iio_utils: fix digit calculation Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 15/91] iio: light: tsl2583: Fix module unloading Greg Kroah-Hartman
2022-11-02 2:32 ` [PATCH 5.10 16/91] iio: temperature: ltc2983: allocate iio channels once Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 17/91] fbdev: smscufx: Fix several use-after-free bugs Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 18/91] fs/binfmt_elf: Fix memory leak in load_elf_binary() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 19/91] exec: Copy oldsighand->action under spin-lock Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 20/91] mac802154: Fix LQI recording Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 21/91] scsi: qla2xxx: Use transport-defined speed mask for supported_speeds Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 22/91] drm/msm/dsi: fix memory corruption with too many bridges Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 23/91] drm/msm/hdmi: " Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 24/91] drm/msm/dp: fix IRQ lifetime Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 25/91] mmc: sdhci_am654: select, not depends REGMAP_MMIO Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 26/91] mmc: core: Fix kernel panic when remove non-standard SDIO card Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 27/91] counter: microchip-tcb-capture: Handle Signal1 read and Synapse Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 28/91] kernfs: fix use-after-free in __kernfs_remove Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 29/91] perf auxtrace: Fix address filter symbol name match for modules Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 30/91] s390/futex: add missing EX_TABLE entry to __futex_atomic_op() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 31/91] s390/pci: add missing EX_TABLE entries to __pcistg_mio_inuser()/__pcilg_mio_inuser() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 32/91] Xen/gntdev: dont ignore kernel unmapping error Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 33/91] xen/gntdev: Prevent leaking grants Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 34/91] mm/memory: add non-anonymous page check in the copy_present_page() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 35/91] mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 36/91] net: ieee802154: fix error return code in dgram_bind() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 37/91] media: v4l2: Fix v4l2_i2c_subdev_set_name function documentation Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 38/91] drm/msm: Fix return type of mdp4_lvds_connector_mode_valid Greg Kroah-Hartman
2022-11-04 17:06 ` Pavel Machek
2022-11-02 2:33 ` [PATCH 5.10 39/91] ASoC: qcom: lpass-cpu: mark HDMI TX registers as volatile Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 40/91] arc: iounmap() arg is volatile Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 41/91] ASoC: qcom: lpass-cpu: Mark HDMI TX parity register as volatile Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 42/91] ALSA: ac97: fix possible memory leak in snd_ac97_dev_register() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 43/91] perf/x86/intel/lbr: Use setup_clear_cpu_cap() instead of clear_cpu_cap() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 44/91] tipc: fix a null-ptr-deref in tipc_topsrv_accept Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 45/91] net: netsec: fix error handling in netsec_register_mdio() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 46/91] net: hinic: fix incorrect assignment issue in hinic_set_interrupt_cfg() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 47/91] net: hinic: fix memory leak when reading function table Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 48/91] net: hinic: fix the issue of CMDQ memory leaks Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 49/91] net: hinic: fix the issue of double release MBOX callback of VF Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 50/91] x86/unwind/orc: Fix unreliable stack dump with gcov Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 51/91] amd-xgbe: fix the SFP compliance codes check for DAC cables Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 52/91] amd-xgbe: add the bit rate quirk for Molex cables Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 53/91] atlantic: fix deadlock at aq_nic_stop Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 54/91] kcm: annotate data-races around kcm->rx_psock Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 55/91] kcm: annotate data-races around kcm->rx_wait Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 56/91] net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 57/91] net: lantiq_etop: dont free skb when returning NETDEV_TX_BUSY Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 58/91] tcp: minor optimization in tcp_add_backlog() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 59/91] tcp: fix a signed-integer-overflow bug " Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 60/91] tcp: fix indefinite deferral of RTO with SACK reneging Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 61/91] can: mscan: mpc5xxx: mpc5xxx_can_probe(): add missing put_clock() in error path Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 62/91] can: mcp251x: mcp251x_can_probe(): add missing unregister_candev() " Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 63/91] PM: hibernate: Allow hybrid sleep to work with s2idle Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 64/91] media: vivid: s_fbuf: add more sanity checks Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 65/91] media: vivid: dev->bitmap_cap wasnt freed in all cases Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 66/91] media: v4l2-dv-timings: add sanity checks for blanking values Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 67/91] media: videodev2.h: V4L2_DV_BT_BLANKING_HEIGHT should check interlaced Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 68/91] media: vivid: set num_in/outputs to 0 if not supported Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 69/91] ipv6: ensure sane device mtu in tunnels Greg Kroah-Hartman
2022-11-04 17:11 ` Pavel Machek
2022-11-04 17:23 ` Eric Dumazet
2022-11-04 17:31 ` Pavel Machek
2022-11-04 17:35 ` Eric Dumazet
2022-11-02 2:33 ` [PATCH 5.10 70/91] i40e: Fix ethtool rx-flow-hash setting for X722 Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 71/91] i40e: Fix VF hang when reset is triggered on another VF Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 72/91] i40e: Fix flow-type by setting GL_HASH_INSET registers Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 73/91] net: ksz884x: fix missing pci_disable_device() on error in pcidev_init() Greg Kroah-Hartman
2022-11-02 2:33 ` [PATCH 5.10 74/91] PM: domains: Fix handling of unavailable/disabled idle states Greg Kroah-Hartman
2022-11-02 2:33 ` Greg Kroah-Hartman [this message]
2022-11-04 17:15 ` [PATCH 5.10 75/91] net: fec: limit register access on i.MX6UL Pavel Machek
2022-11-02 2:33 ` [PATCH 5.10 76/91] ALSA: aoa: i2sbus: fix possible memory leak in i2sbus_add_dev() Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 77/91] ALSA: aoa: Fix I2S device accounting Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 78/91] openvswitch: switch from WARN to pr_warn Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 79/91] net: ehea: fix possible memory leak in ehea_register_port() Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 80/91] nh: fix scope used to find saddr when adding non gw nh Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 81/91] net/mlx5e: Do not increment ESN when updating IPsec ESN state Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 82/91] net/mlx5: Fix possible use-after-free in async command interface Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 83/91] net/mlx5: Fix crash during sync firmware reset Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 84/91] net: enetc: survive memory pressure without crashing Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 85/91] arm64: Add AMPERE1 to the Spectre-BHB affected list Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 86/91] scsi: sd: Revert "scsi: sd: Remove a local variable" Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 87/91] arm64/mm: Fix __enable_mmu() for new TGRAN range values Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 88/91] arm64/kexec: Test page size support with " Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 89/91] can: rcar_canfd: rcar_canfd_handle_global_receive(): fix IRQ storm on global FIFO receive Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 90/91] serial: core: move RS485 configuration tasks from drivers into core Greg Kroah-Hartman
2022-11-02 2:34 ` [PATCH 5.10 91/91] serial: Deassert Transmit Enable on probe in driver-specific way Greg Kroah-Hartman
2022-11-02 11:09 ` [PATCH 5.10 00/91] 5.10.153-rc1 review zhouzhixiu
2022-11-02 11:25 ` Rudi Heitbaum
2022-11-02 17:20 ` Pavel Machek
2022-11-02 18:05 ` Florian Fainelli
2022-11-02 20:46 ` Guenter Roeck
2022-11-02 21:12 ` Allen Pais
2022-11-03 7:27 ` Naresh Kamboju
2022-11-03 12:20 ` Sudip Mukherjee
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221102022057.177463393@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=andrew@lunn.ch \
--cc=jbe@pengutronix.de \
--cc=kuba@kernel.org \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).