From 44439c3ea0bea7ab3297b0e3471444f8852aaebd Mon Sep 17 00:00:00 2001 From: Bjarne von Horn Date: Mon, 8 Apr 2024 11:35:14 +0200 Subject: [PATCH] Fix stmmac nullptr dereference ``` Apr 08 11:15:37 conga-smarc-2 kernel: hrtimer_try_to_cancel+0x15/0x130 Apr 08 11:15:37 conga-smarc-2 kernel: hrtimer_cancel+0x11/0x30 Apr 08 11:15:37 conga-smarc-2 kernel: stmmac_release+0xea/0x3a0 [ec_dwmac_intel] Apr 08 11:15:37 conga-smarc-2 kernel: ec_device_close+0x2d/0x40 [ec_master] ``` --- devices/stmmac/stmmac_main-6.1-ethercat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/devices/stmmac/stmmac_main-6.1-ethercat.c b/devices/stmmac/stmmac_main-6.1-ethercat.c index 01851fd9..a20f48e2 100644 --- a/devices/stmmac/stmmac_main-6.1-ethercat.c +++ b/devices/stmmac/stmmac_main-6.1-ethercat.c @@ -3983,8 +3983,10 @@ static int stmmac_release(struct net_device *dev) stmmac_disable_all_queues(priv); - for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) - hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); + if (!get_ecdev(priv)) { + for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) + hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer); + } netif_tx_disable(dev);