From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795881001; b=bCYSm7PCkVvbdokwP8p8xLv4Hz7/fyUuP68G7xdOXQfnUf4lAenR4SgqPgd/qHKHTYWq cjdT/EhKw4HJhQu1d8Bl4d/7WZ8NnWg030sU8b8Y718LhXCFUwTH/sCsSJsoy1sMCEJ3R 62qywCxfgtDW1Ar0UwvOtbMO0ApHcL7j/WzfVQgwU/0xBBOtrN1hIChyYmsm6gN347jp7 bO+MqM6yD8U7Emp5xAgDIfRL2Odk/EKVEehL9IcSNhzsdLqLD9oBCW6WO4unR/Dp11YKF 2PdSv2ttVlWXO1RxHnbstPYWV8z/cNQbzkpqIYmfv8M8D7KoxDbCOMsDQiCOr1k10Jg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795881001; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=/T8ElhkmmcxJ81RHQyuNq3f8gDbi3dSGIwszjZu09Dg=; b=LP09VtmQqpwySinU/YO1xNxbne+uUDCNPqKwk29d0FtgPvYeboukZA/rboaar07nn9nT O3NlHKd9Q6P31QLPX3F5/W1UMveNRhvyiulpZ7uQzBKSXglbb0hQjgbVEaRkSN8v9TtBG JAjZDAjW3SdX3HnMzROUlFVZbC76Ldunf90YTxsrRktGUgRS6X0ivPTit92h9hBxwBkWG iCZOoAiH4q0nyutE1j/awnyer3SNemQkS508/tQDjqyWKU7MjPd3974zzqi5P3s5jAxGk OHGh9nPkFXclQA3Y7GvV2uwSTt6fh9TqpGqPDeRkVQfXTDQ7xOSK2sSEg6uGnbU0yWw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FeXMYxq7; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5202606A31F; Sat, 28 Nov 2026 15:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FeXMYxq7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B9751F000C1; Sat, 28 Nov 2026 15:49:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795881000; bh=/T8ElhkmmcxJ81RHQyuNq3f8gDbi3dSGIwszjZu09Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FeXMYxq7ghVObhW4cTgWhVOBCgCsRIZ9DGMCBLeGml5Qtx3mQXxuCYEnhMkvPX7yZ y1Isb9c6tUk6opfukGyk37rYwq5Bnl5QuR7v6v88svljdG+7Iupr/e57QgJlQBNu2i tiy8IJ3/VI4YiEXr3ToJDbudYuw0S7j0iMUE/V0CDBeA6Rd0aGl9hIqsBbTrltvpT1 7VRhFCjn4L5nGDwAB11YCKp+YHPv6xVvyUQcA45erXj67EiiGyBnvyfzD5Gq3z3QHX Lf+FO2jU8A2qveIP4IQRaf87EgI/8mUVNU0/+957bZUrXuv13piVCwyr6gCJ38/oiO 29ugY6y6lfdqQ== From: Imre Kaloz To: Thomas Bogendoerfer , netdev@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-mips@vger.kernel.org, Sashiko , stable@vger.kernel.org Subject: [PATCH net-next v2 1/2] net: sgi: ioc3-eth: request the IRQ in open, not probe Date: Sat, 28 Nov 2026 16:49:52 +0100 Message-ID: <20261128154953.2664-2-kaloz@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261128154953.2664-1-kaloz@kernel.org> References: <20261128154953.2664-1-kaloz@kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The shared IRQ is requested in probe before the rings, lock and timer its handler uses exist, and under devm it outlives free_netdev() on the error paths and in remove. Request it in ndo_open once the RX buffers exist and free it in ndo_stop before stopping the chip, because free_irq() waits for a running handler and ioc3_error() restarts the chip. Found by review; with DEBUG_SHIRQ, unbinding the driver without this change faults on freed memory. Tested on an SGI Fuel with DEBUG_SHIRQ and SLUB_DEBUG_ON: link down/up and driver unbind/rebind. Fixes: 0ce5ebd24d25 ("mfd: ioc3: Add driver for SGI IOC3 chip") Reported-by: Sashiko Closes: https://lore.kernel.org/all/179473760071.2199510.16065103101920438822@kernel.org/ Closes: https://lore.kernel.org/all/179504054981.3136.8539477779059154181@kernel.org/ Cc: stable@vger.kernel.org Signed-off-by: Imre Kaloz --- drivers/net/ethernet/sgi/ioc3-eth.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/sgi/ioc3-eth.c b/drivers/net/ethernet/sgi/ioc3-eth.c index ee284a4f75ff..5023d05e7e38 100644 --- a/drivers/net/ethernet/sgi/ioc3-eth.c +++ b/drivers/net/ethernet/sgi/ioc3-eth.c @@ -781,6 +781,7 @@ static inline void ioc3_stop(struct ioc3_private *ip) static int ioc3_open(struct net_device *dev) { struct ioc3_private *ip = netdev_priv(dev); + int err; ip->ehar_h = 0; ip->ehar_l = 0; @@ -790,6 +791,13 @@ static int ioc3_open(struct net_device *dev) netdev_err(dev, "%s: rx buffer allocation failed\n", __func__); return -ENOMEM; } + err = request_irq(dev->irq, ioc3_interrupt, IRQF_SHARED, "ioc3-eth", + dev); + if (err) { + netdev_err(dev, "Can't get irq %d\n", dev->irq); + ioc3_free_rx_bufs(ip); + return err; + } ioc3_start(ip); ioc3_mii_start(ip); @@ -803,6 +811,9 @@ static int ioc3_close(struct net_device *dev) timer_delete_sync(&ip->ioc3_timer); + /* ioc3_error() restarts the chip, so free the IRQ before stopping it */ + free_irq(dev->irq, dev); + netif_stop_queue(dev); ioc3_stop(ip); @@ -870,13 +881,6 @@ static int ioc3eth_probe(struct platform_device *pdev) goto out_free; } - if (devm_request_irq(&pdev->dev, dev->irq, ioc3_interrupt, - IRQF_SHARED, "ioc3-eth", dev)) { - dev_err(&pdev->dev, "Can't get irq %d\n", dev->irq); - err = -ENODEV; - goto out_free; - } - spin_lock_init(&ip->ioc3_lock); timer_setup(&ip->ioc3_timer, ioc3_timer, 0); -- 2.47.3