From nobody Fri Sep 25 15:13:22 2026 Received: from mail-qv2-f12.google.com (mail-qv2-f12.google.com [74.125.230.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53BBC3A8388 for ; Thu, 10 Sep 2026 23:54:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.230.140 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084478; cv=none; b=D29qkdfJ7xE52hEn+4HORFpn6/gumz8uMUhjfcjTcMG9hQQbF5STMNEzv0J9or5rLSiyBS0eO3vEwIbsqE1sP4TFkCAlVcHQzG+PCxDf/e99sQbc0x2LovcE53Y5LGaDuFnJyYOzWhaOePHjYZc9uDJpAc7ThBCyJmJL1EMZv+E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084478; c=relaxed/simple; bh=Nn4Ptuj8Cpmwpi6QuWhGjH0tnJrjo/sXPNOtUF2QonU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RQWLB470oLFufwCEBwvJR0igLelS2SU7B6TQ8Vtbjrb+Qy3d4xerEIft2zVjrkmIB5IO3ywQLII8xdGQKz9010jR7qzespao0/mi6KC39rv8v2OJVGPi1iGbo2Lr4z45aPW5sTC0OR4QzxSGiHed96f5kGdciRJAWNm7PH62uhc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ldhjssNh; arc=none smtp.client-ip=74.125.230.140 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ldhjssNh" Received: by mail-qv2-f12.google.com with SMTP id 6a1803df08f44-90cdfc6db09so3270436d6.2 for ; Thu, 10 Sep 2026 16:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789084475; x=1789689275; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=iEJC8ovy/jeEI3H151lIUXdkoPv4NnE0mIQL+cpW8Yg=; b=ldhjssNhDNZSRL44J0gvm7N1HygxUF5u8xfhovLW7h+MEo59NswSXM2UAJa0eJ60yl m7cHizF6hGtyABW8Axn0ItPztgFjEhqtfrt4J9AX00vneJDzuCr096r5SDSaq2I9QxUa XRNagJwaCh7rCHcCwb5dDqv0O8WR6AbAlYUHtZVLeOiy0/KtWk4JdkGiQiyCyXz0BrJW a30r2x+P+2f+HiG82YQ28aCqGI+AkTioxj9ppUrn/kZKVuK+A8w7cMCXOHvmRg1DEzwH lULFwbwzfL9rfSvlVMbyGnFc/IEw3jEAGTiHuqJst+BSKVJJGRcBHKyYeQPRPIsZnFmK 6ThA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789084475; x=1789689275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=iEJC8ovy/jeEI3H151lIUXdkoPv4NnE0mIQL+cpW8Yg=; b=lVh9+yV1mnADWoTr/fxxJ5ezW1ogs3EX2m0683aqYp9nSzFWZh4nHcnvW2HDyXwu9Y xT5YO288fk+y1sEjkzY4Lbhfj/tFtssevjAzO42Fv0Xd1QddN23R3CYh6eRv0GI4DCfH cQ5nJjC69/LlHtNicoPKWTNNj1zIyHi/s3D5NM0lyBncP667HuAk3i6rpLC+Rw7dQX3x MGADmjDNO8KVrXncEqLO7vykvynDuOHObPn7th1nBYzfo8ADMm9MZDcDsmCGCDAW+quz 7AZusdzjBhg6vixia2juxVCKJQYPirXrJYf/xcyBxRbqelPhZFeYzzsoCq/FFjXX4KSP WuqQ== X-Forwarded-Encrypted: i=1; AKwUvBxQx3pX4maPVnL2medg+NyImy1uqsFT0/E97Op+5XZ6TPbTzEmQzlA3BPISF6XpFu3LvdVLZZ3ji7efAnQ=@vger.kernel.org X-Gm-Message-State: AFuF++laYYiIbQNVy943dF2NDSVuu+J4/8zCEZHADozZhPSLR9Z5dkoT K3sW0rw40xiGpoJz1VUCtpPnHupXSqPF9Ue6f+eHL1P7KC3tHRmiKnQ= X-Gm-Gg: AYBFou1v4p11M8HsMbgfB5rR8f398GN0mc4tLbBuEmsVJBLOW8mefUqSHyClNBX7s3r NTj1P+KtyA4Wkzsg67DUkDHoe+kGHOd2CnOsz7Pu85WKhi/pszm12H2F8Gkw5YcnOzGDGaa49gy s1KN8+3DeeezKjEVG9VrpfoL19mlzxp3zU2JA0ZcjhZ6MVZOTwrt3eXQh0JFvcFoP2aifu6aTNJ tSTG1Pasv6e0iWg7oT8rsYHymK3VqASSsskGtXFEywAcQ/Ocih2quYem3KPR1bBVXytTM6MOeNO i/IsKsLh0d/Hsu/JQ30QzlkXutJPkOI0neaGH/SZxId6NG3ICAOFSwXHY3OOIjhNMMU62qqnCGL /wylxqZ2kWrJ0D9UUKeKq3x1FsNwBfdsfvjD+bVY2YvOXksL23r/csftbz5LlKWC1fgfYYCozx8 ug5iPwes7vB8lK34Nxrei5cxoU20iHfljKpC610j4r0LggAjOKjbiRn0nvPUfX4tONlSfb3CPvS h31gBhwBUMnHENKW2Nufnh06pMw4o9HuXzvfMOWcZt0kud0SnXtTGbqVwszsRZ7l+DJfC59N4t5 IgN4BEygrUOluxkWGwJYzUFe20d0yZHV7Q== X-Received: by 2002:a05:622a:1a8c:b0:530:b2e3:86c0 with SMTP id d75a77b69052e-530c877ae0dmr35072231cf.50.1789084475199; Thu, 10 Sep 2026 16:54:35 -0700 (PDT) Received: from localhost.localdomain ([104.39.73.78]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-530ca48912csm6100771cf.13.2026.09.10.16.54.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 10 Sep 2026 16:54:34 -0700 (PDT) From: Myeonghun Pak To: Zhao Qiang Cc: Krzysztof Halasa , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Alexandra Diupina , Christophe Leroy , Ijae Kim , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v3 1/4] net: wan: fsl_ucc_hdlc: validate protocol before starting device Date: Thu, 10 Sep 2026 19:54:27 -0400 Message-ID: <9cdca816ef561fec983c79c39a3bb9564d4a0e06.1788128904.git.mhun512@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" uhdlc_open() starts the UCC, IRQ and NAPI before it calls hdlc_open(). If no HDLC protocol has been attached, hdlc_open() returns -ENOSYS. The error path then calls uhdlc_close(), which calls hdlc_close() and dereferences hdlc->proto even though it is NULL. Bringing up a freshly registered interface before an IF_PROTO ioctl can therefore trigger a NULL pointer dereference. Call hdlc_open() before enabling the hardware. Balance a successful protocol open with hdlc_close() if requesting the IRQ then fails. This matches peer HDLC drivers and avoids running teardown for a protocol that never opened. Fixes: a59addacf899 ("drivers/net: process the result of hdlc_open() and ad= d call of hdlc_close() in uhdlc_close()") Cc: stable@vger.kernel.org Reported-by: Jakub Kicinski Link: https://lore.kernel.org/r/20260806020541.2011936-2-kuba@kernel.org Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- drivers/net/wan/fsl_ucc_hdlc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 809f21fb93f56..82796452e54a2 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -34,8 +34,6 @@ #define TDM_PPPOHT_SLIC_MAXIN #define RX_BD_ERRORS (R_CD_S | R_OV_S | R_CR_S | R_AB_S | R_NO_S | R_LG_S) =20 -static int uhdlc_close(struct net_device *dev); - static struct ucc_tdm_info utdm_primary_info =3D { .uf_info =3D { .tsa =3D 0, @@ -705,12 +703,18 @@ static int uhdlc_open(struct net_device *dev) hdlc_device *hdlc =3D dev_to_hdlc(dev); struct ucc_hdlc_private *priv =3D hdlc->priv; struct ucc_tdm *utdm =3D priv->utdm; - int rc =3D 0; + int rc; =20 if (priv->hdlc_busy !=3D 1) { + rc =3D hdlc_open(dev); + if (rc) + return rc; + if (request_irq(priv->ut_info->uf_info.irq, - ucc_hdlc_irq_handler, 0, "hdlc", priv)) + ucc_hdlc_irq_handler, 0, "hdlc", priv)) { + hdlc_close(dev); return -ENODEV; + } =20 cecr_subblock =3D ucc_fast_get_qe_cr_subblock( priv->ut_info->uf_info.ucc_num); @@ -729,13 +733,9 @@ static int uhdlc_open(struct net_device *dev) napi_enable(&priv->napi); netdev_reset_queue(dev); netif_start_queue(dev); - - rc =3D hdlc_open(dev); - if (rc) - uhdlc_close(dev); } =20 - return rc; + return 0; } =20 static void uhdlc_memclean(struct ucc_hdlc_private *priv) --=20 2.47.1 From nobody Fri Sep 25 15:13:22 2026 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B5073B38A9 for ; Thu, 10 Sep 2026 23:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084484; cv=none; b=ZRkPmKMoF/B4D5ytLptOT2wOtaUfvoG/4VZbH6UELj5j5KvLpxcqH6k7aHyOo2vlFdAXY0TJbmjnJm1TJEhnJp0wHDyTM640pmV2X7LwJ/vwvXrBFhOFu/HKJ2qz7n9Uru4ctrreg31i6N7+lPY9pobvwfrbjknnMc/8z3ULAhk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084484; c=relaxed/simple; bh=xtwXIZOGEy5UPVOOx7FUe2g9BLc+qYFqk68bmhTQ99M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bBHKOhejOdsO0+VfDM5x3WkMZKl6CrvAlsmK/dQEGxCa2aXOsbMxcVwE7TNzg7LwNU84E4raR1hBc/vk5NSTin2sbkJm245HXnwmluGVsTl+xNTG8cOiePPKrzET/qozqI9cK1s+s10rfBEd20uTC1ZtsNZTP81kH6obGy1cv2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TTiUtQcK; arc=none smtp.client-ip=209.85.160.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TTiUtQcK" Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-5302b692c8eso4572491cf.2 for ; Thu, 10 Sep 2026 16:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789084481; x=1789689281; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=s6Jijc6okwul17I+K9OvRXUy0M5JwDpgrdpc+hLNXWA=; b=TTiUtQcK8aG0QpD/SYJiUVqSfHdtQD3Ms7fN3ZkeU0EH7a3hiPQgylYaKPyTaog7ax meGJduErQ+jwgZmVZ5/fgmNJHgAaChs4yYedsEHHs/v3qy9qx0x/R0mnpnw1JcIw+Nf5 SOZIe6GJA85edaMR3N6jeHbJ2IgR6TeDqW21ZKU3eN+n2K1RQVNM3MipUty5kZvDgoeP ZEl7K1CjPRI0y6QRKifRk9QP9s5+3eWzzCxkLjpsKvdLtGDb/RewrIPIKXipBjXGntpN 3jmDxXJg946gfLJqU6kl1JErC2LTZMs+dMqDzpIhLmh16JDx7RiyJn4eqx9bdryzsdqy DkpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789084481; x=1789689281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=s6Jijc6okwul17I+K9OvRXUy0M5JwDpgrdpc+hLNXWA=; b=GZwsJ2mPKnlSZVEVnkJQNI6AcSNP+A1ExDQhAxyEha9I/Yd1zZY5UGuF4xYFe8tkIw +Jij0vCmPi/ZP/Mi/ZnvTy1ntzAqptrhmgbPYp+KlRLEiG0By/5feqTpuynl7l6C5yU6 jHpo2E26X5/Er2a12PWBTnsly6ILfoxkI1ndsfZ76got9Q6xjNXmztQE95Ty9SO/iA2B h9CcwxwCP+Wh1Gsa69g8d/eY99cvVdo5ae+cIcXGiTASjc8MGC0iEJ1e7fEAbLimgA0K yVXB0Xi0V4k9+LtFxDy/aNj3I/XnrQKE6Ob5aNGK14A9WAd2rs/gbDYwNuDFOszAV1bK cz1Q== X-Forwarded-Encrypted: i=1; AKwUvBxx2mZyHrbhDFR+8rC+trzJOjVWZBUMiBDZLVjIBw5tz4ofEspfo3xK5L4pChSHk/5O3fuewE4Lm57CrmM=@vger.kernel.org X-Gm-Message-State: AFuF++ljsEZBZ3hyppmtqu6Sm2pslb6WC4YSRURSfDio3q9Djc+b82Z/ VGVaMwKMoxbDxtaINGsnCN6gZ2tlFTAVY9EqI8p6i2iK9quA4IYtK80= X-Gm-Gg: AYBFou1ZEQlkJirQhUVzdPbCc4bFV9CHnAqkUYEfjpzqgyN8fzqcJcVJbmttJJK1p3X j6EmweS5EL8IiYFIBU++R+mbKv6wFFGm83/CJfJwoTuFBY9fU1lnexXaPy5LeeWZYZ7rN4MPcu5 2nXFrgAgYF3yyu1Y6Lvn674nDJDrygMUoPW80RiCMOt+sjfdkOJQQ5tHA8RgL2N107SeCtY3qBw fFqaS0eE0Ra4ZlG3/2xmC6YWoJ+9TKWBucg7njwMqxPXdlrLSZF2/ud9eGwWfIQs5XyAeCz+6k0 BesgxgPmDnPvPVznstFRxIvLTL7IVJYzcvhNQpDwlMLZzqLbrwIhliBEkCddR7gDiof5dJHc7dd j0mpSfmUeoHbdaBzTb4+aNC1bfR7OSewZxBYAY5TSs2sBYJmiYtoe85gT+3SpIkQiplOsSve1F0 TRKbp/j26sy1kM6XvPmrADFdCKVp1/XgifhQDkn4169WaZmB8qyPlYjoK8ORgcrv3mVO2HWl8F7 LvQCoa7uUv/okfqRPLCmK7CCIf1RwoYzgfJrBIP0WM/226b+Y1kgAgj3IuCLtzq8UnB9YUgpE3k My/K6FX0DF76wkXkV8ETuDMIBXIHUJCCv0s= X-Received: by 2002:a05:622a:1389:b0:530:b2e4:d5a2 with SMTP id d75a77b69052e-530c87a548amr28704191cf.61.1789084476627; Thu, 10 Sep 2026 16:54:36 -0700 (PDT) Received: from localhost.localdomain ([104.39.73.78]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-530ca48912csm6100771cf.13.2026.09.10.16.54.35 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 10 Sep 2026 16:54:36 -0700 (PDT) From: Myeonghun Pak To: Zhao Qiang Cc: Krzysztof Halasa , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Alexandra Diupina , Christophe Leroy , Ijae Kim , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v3 2/4] net: wan: fsl_ucc_hdlc: allocate suspend backup before quiescing Date: Thu, 10 Sep 2026 19:54:28 -0400 Message-ID: X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" uhdlc_suspend() detaches the netdev and disables NAPI before allocating the parameter RAM backup. If that allocation fails, suspend returns -ENOMEM with the interface still running but NAPI disabled. The PM core does not call resume after a failed suspend, so a later close attempts to disable NAPI again and can wait indefinitely. Allocate the backup before changing the runtime state. An allocation failure then leaves the interface attached and NAPI enabled. Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC") Cc: stable@vger.kernel.org Reported-by: Jakub Kicinski Link: https://lore.kernel.org/r/20260806020541.2011936-2-kuba@kernel.org Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- drivers/net/wan/fsl_ucc_hdlc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 82796452e54a2..596f4ef053636 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -888,6 +888,10 @@ static int uhdlc_suspend(struct device *dev) if (!netif_running(priv->ndev)) return 0; =20 + priv->ucc_pram_bak =3D kmalloc_obj(*priv->ucc_pram_bak); + if (!priv->ucc_pram_bak) + return -ENOMEM; + netif_device_detach(priv->ndev); napi_disable(&priv->napi); =20 @@ -897,10 +901,6 @@ static int uhdlc_suspend(struct device *dev) priv->gumr =3D ioread32be(&uf_regs->gumr); priv->guemr =3D ioread8(&uf_regs->guemr); =20 - priv->ucc_pram_bak =3D kmalloc_obj(*priv->ucc_pram_bak); - if (!priv->ucc_pram_bak) - return -ENOMEM; - /* backup HDLC parameter */ memcpy_fromio(priv->ucc_pram_bak, priv->ucc_pram, sizeof(struct ucc_hdlc_param)); --=20 2.47.1 From nobody Fri Sep 25 15:13:22 2026 Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86AE33ACEFB for ; Thu, 10 Sep 2026 23:54:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084482; cv=none; b=of22eqfvfmHslLM0azknHmYH5grIV51uN9u+2MbIc4fMTPRSWYrY9voJs5rLxci9M9rwB2dPhTJxZBEDOPU6omXzpIYXjH7WUbwQEjdlS1B6q7UOanS8qp6RaMYDHqt7u36mFpH5CAuNpSukZljq6e8R6PzmzkOLBxZgTihX5h8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084482; c=relaxed/simple; bh=zm+IFtkQupAeQomjz92QbxQc3kRIUVTD3HYLMJXnvk0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ik3728S5GFMCjNXN4l2rWe5zbNESTSvVzTd5QpKqhFP3DpWnosKSEoD99s1rF8CHENcurwKamu9fKzrX/tbYyoxci6/B3VnZYjT3tLdeQ3u/SU0rsXD3whR2HmdduYKOgVtUK9UKHD9T11UgYpHZ05g5+kvog+NO7xd0Z+j+eGU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eFO3jTsq; arc=none smtp.client-ip=209.85.160.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eFO3jTsq" Received: by mail-qt1-f179.google.com with SMTP id d75a77b69052e-51bfe810293so4498241cf.1 for ; Thu, 10 Sep 2026 16:54:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789084478; x=1789689278; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aXOUF/0dKfcL9nM72QWKoaIot6Ph6ib6YvMRCU6EYeU=; b=eFO3jTsqOROUsoQ30Eqdrcr5CxPaYfHb4kCKtTwkQNXgqyu/bWRP5WlTfGXFWCVibm kpnAu4Ya/Az2CmzhQSVOu35wIRPpDzBwqVw6hFCU7KzcDOtaAmeppkiKwJAvUlMJyGTX UitLIx6AnzlVMYHUA1ev0qj417V9Zz1NUyuE+n3dpxEQ80ACX3/XgS+MnOTPBrV/S+/2 Kh+NFSbnaWqADKh9Jkdfkknk0KEsb1me5216Za6awGLSp3VR1XJEHmb0Wu7BszTYRiS/ XUiv0t0RGwyEDULGh+9VGool2oX5Q/d0ZXEiunPPalKLp+euAbmcq3MxII8dLljyJUx9 uFQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789084478; x=1789689278; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=aXOUF/0dKfcL9nM72QWKoaIot6Ph6ib6YvMRCU6EYeU=; b=M6F52d8KGPkZnu1Wr8uC9zVKqd101p+3B2om8/KbQxmwq5lN7C72Yq4v1036zUiEyD EPbGD+xP8kL8XEUDAeSuQ1+1xR1YClP25wJqQf+LdU/kwnLonf2divfvvI9s6+uJ9FaA qDtFgfnmnztlRczcUGIQ2nVO+gpTV1BUrbuDfLEoUQ9/8htES8uom/o3cHEhJpEVNOKE 5y6JQykWwpxN1ZKp+Sq8jhA40eKIKa4ND2F6Fwh39EQ+PRAwuo/xheUtDLfupSRdA4Ex TAIeqn14DEh6GuVm9/FUB7TqtDCgiFM8cdBWo8uz5+vp0Wm1tlSgj+CznGybTJcJT7a8 anUw== X-Forwarded-Encrypted: i=1; AKwUvBzlogLsWJvbdOO5PXN2ZtAc2CsBvOa0FrpsmeQzPu2vM1o+Pr83D4T76LTuRvM2Yehbbj1cn22IQCFdHu8=@vger.kernel.org X-Gm-Message-State: AFuF++m62osAwLXJU7tKcbT766zUqKmKqizAfUmUV0vZEMF8a+o5yyht wvjokN16mDEbTdqJg61xbwa+aEtQPr/YmJ/6/ADIwyHyoEPvWsr6xA4= X-Gm-Gg: AYBFou2Hf8BLtEL6yeSBSDVrkGWzyMFo7LNPF1C6HEyYk8uff12iblDbDnssNwAnU+x Q8T6gXVVnfopHlDza1PkBTJ1RkEG8Z/l6tiJlFXJTGDZPqlojvFKCEQ92Bpm4N1kTeaiCMngRtr X7hrz5oKIMzxVGDjIgqbYU1ecFx9NFC+U0OxYm02yEKnQRcCpBq1OANEoWrpTt0wkiDIM8biPv/ IQP5ytRzD2mOtzE9nQlbCuPUuvcxnTFiZdlim/IFSYLkyLj/2jSlYnc2Di4VwkUJi8bRGaaYfyV pyW2bR2pmTE+TL9fZ7fxsrt3SH+a8jszznmgxuXsT4BeyYdtkURHV04lhznVlGI0kxC7hmgAzZF 9toHXy19CgXmqKM4dyOTCiKH+IMx8vBUTAftuMjH2KUX7UHHykH3sN4P2eMTuZEq1Z+Ucwb0Qs7 hPeRavVDOVQqfYWO8Phcqq6mtfe9+cbU9lTlJWdLDmgm7y9y1ARSP7t1C5bHiSxu3EoG9kOpUGs yG8Xr8w5dHZVCO/5Fm+Vs3aK3gJpYn1nC/ZRaSNBvtM0MUSjWjCNBkpzhtI9L7sIfL0XTi/yTI7 D0e6O0c7QbxNHe5NY0o4m7zs1HKagAL5yzrV62RRA9B4Yw== X-Received: by 2002:a05:622a:1a96:b0:52f:ab8f:43dd with SMTP id d75a77b69052e-530c871239amr28491771cf.38.1789084478245; Thu, 10 Sep 2026 16:54:38 -0700 (PDT) Received: from localhost.localdomain ([104.39.73.78]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-530ca48912csm6100771cf.13.2026.09.10.16.54.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 10 Sep 2026 16:54:37 -0700 (PDT) From: Myeonghun Pak To: Zhao Qiang Cc: Krzysztof Halasa , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Alexandra Diupina , Christophe Leroy , Ijae Kim , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v3 3/4] net: wan: hdlc: close active devices before protocol detach Date: Thu, 10 Sep 2026 19:54:29 -0400 Message-ID: X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit ff3516442768 ("WAN: HDLC: Detach protocol before unregistering device") moved protocol detach ahead of netdev unregister so detach could still use its state. However, detach_hdlc_protocol() calls hdlc_setup_dev(), which clears IFF_UP. unregister_netdevice() then sees an already-down device and skips ndo_stop, leaving an active HDLC device running while its driver releases resources. Close the device under RTNL while its protocol is still attached, then keep the existing detach-before-unregister order. This runs the hardware stop callback and the protocol close callback before their state is released. Audit all current users: c101, n2, pc300too, pci200syn, wanxl, ixp4xx_hss, fsl_qmc_hdlc and farsync unregister before releasing the resources used by their close callbacks. The farsync probe unwind can disable interrupts and free its RX DMA buffer first, but fst_close() does not use that buffer or require interrupts; the card is also in FST_RESET, so fst_closeport() does not access the port hardware. Fixes: ff3516442768 ("WAN: HDLC: Detach protocol before unregistering devic= e") Cc: stable@vger.kernel.org Reported-by: Jakub Kicinski Link: https://lore.kernel.org/r/20260806020541.2011936-2-kuba@kernel.org Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- drivers/net/wan/hdlc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index cbed10b1d862e..a38f90d3006ed 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c @@ -263,6 +263,7 @@ EXPORT_SYMBOL(alloc_hdlcdev); void unregister_hdlc_device(struct net_device *dev) { rtnl_lock(); + dev_close(dev); detach_hdlc_protocol(dev); unregister_netdevice(dev); rtnl_unlock(); --=20 2.47.1 From nobody Fri Sep 25 15:13:22 2026 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F3863B0AE9 for ; Thu, 10 Sep 2026 23:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084482; cv=none; b=qhpPK3rpOp/ueJWx8OnleDGGK/BPgl75E4wtreX3mazrbGQYK1mQ9+A2ODRqbBKdKx2JTm/uxym7JZ/IHRINN3q8H75QSukczVaC1bfxFPZLKRuZ27E9Ljm3ypwhucAy1B+zUpWJL6own2KRv8j3tdswi+q8LBEW2OvCX+vp8zQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789084482; c=relaxed/simple; bh=WueL8tY9e+f4EG9kegBhb/48QAgoQxxqkg2Jsh/Y0p0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tBClYIgjgWt56d+TO3WW9dCdtDjU4vrNrJ/ZawOV9yO+flESoX2pr0azMHRzWYf/QiJTZHQd5XPZPLCerFFfA2lTXk3N7xcyJ2IMAldG2BiQ9OLjIUxwhreJrA+VcKeGmBvak9qS/zZiczL3JgjIs9XdqzRw2/luu6GizLzmv8Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aQfK/WOl; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aQfK/WOl" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-5302b692c8eso4572251cf.2 for ; Thu, 10 Sep 2026 16:54:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789084480; x=1789689280; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=imdVCDjW8TkcoAnhfj8hrX1xpu4892DD4sMcv+6zDbc=; b=aQfK/WOlkYplsyVZOLtnvnwYXiMn69OWGKrxDpGWqQn70cuUPsEV5IEJ5CdMGFNVOW zMZLlnpFsn1KV0KC14J7ib3T7rBykqy7m9pys3D010KzJirhmpw7ouSDM1Z8JggoMRmS uNsuh9ezCUOIiRfQx4YUzag+S7std5q+S79zLBI/IfQxMEbEHb2M0jpvQe7Wn/FRXRyC nJyTxwYqIqXAleiH16I3L8+k9GQZYBMhiN0Wj9pqmlbgpWHeecDMCdMU+bE9DiSJxZ1/ nTt7Nh5zOWo2tUL/05n1gJq6oT4ZQ1Z0apNwB8e/4uAIwAW7cp/HqXh9MQyJGU/P4fk0 f/cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789084480; x=1789689280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=imdVCDjW8TkcoAnhfj8hrX1xpu4892DD4sMcv+6zDbc=; b=Hw5WoWvgo3NgKMiTVT0S3xtUp5xGR5c/h6TMf9zo9N8cVSoext9cJmMxAu02KzVz9u DtsnIwpoK/+ZBWPTWbWcpCaeeiUv4W8gusfQs6HbyibW1X+o9K0ul/ISjyXig6fXv4Pg 6wKhHRZaoxwfLeIUh4svcoKBIcugLb5KaVeKwQTiiZj87sxFZOK9os3CNxRPUf2jc3+e 5UYerjIlBufcusvugVq2jLfEKfl5C4CHdoV8gYRKnV1/XI+caIrZbH9H+cS5RZFONv9q xoplnojmqN81oLIqo+02dY7JF8pTKvhtS97wBBeEo7VhDW0IA5CROMKteyOeDQLEX56p 38NQ== X-Forwarded-Encrypted: i=1; AKwUvBzCUCXeqqZtdZ4ys1e63+WVy1cr3JJq6RfEHEMXKpsXRQgCRW/G2zKDNCR7AK5QuZ3uo3Ay3CWvybsypWc=@vger.kernel.org X-Gm-Message-State: AFuF++mMWKsV0JhbbQEjafjEjq2unWvXI6ACzid5Sq3W5EUwxH/f1rZy OIOucIUzvOzQD5sCDJj1tFA6+JBjgz6nfap3gl5yG4nATynRoB0ZBqs= X-Gm-Gg: AYBFou0V89UgEFqaRHk8CkpNo+qk51Bkxiqs7mI8ulzgBUSNx+Y95FqzRKjxFJGaypW jqTshQa5Se+cu7azxed5EP/USGC3QwI3WlBRuvSRZOboZoxRQQs+NdGn9r4GeFC9CQgjSgOcbSS /at/HlctBojbWlrI6JecUAMJLKU5NYo2Y6m1WwiKwQheHwFCacvOr6tzqwPsno3psRTlEL36yrm o+miVSt+d5ZvAJbgHR7HG+C+fi4U4MZT9cNkphas1EJWkxjz7bn9A0IX9zjuEfTe6cbIqUIf6wP VmwfoYsiW1ugvtucJWgiYrUfY43wMzjBf/hHIqFu2lmUAdxD5i6ADfqxBBv5HHWezq1987FHM4h rCNJHTshA+d+wr8KgNLmRNPpc107Ql3ukmxgThNWC7usmdEo9R+KliihaAD9ipYFU5SDrbmJK0e J+m/kNoAZh0sEGR46SaEaPjllPgtOEKGSITT8IWyuSlhctzH6i3Ft2zvDnEPmcb9HxLs95jnHnD qynUG693Nj33tebPXpddnCYRFSWDhHyruYA7/2uzMEkVhAirwEr3NFC8rIaG5can6eHhRmWA07H ri2EC4y7kQdwr3BxjYavNm+0DqBnzi15rg== X-Received: by 2002:a05:622a:2294:b0:530:b2e4:d597 with SMTP id d75a77b69052e-530c87487damr29756721cf.50.1789084479899; Thu, 10 Sep 2026 16:54:39 -0700 (PDT) Received: from localhost.localdomain ([104.39.73.78]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-530ca48912csm6100771cf.13.2026.09.10.16.54.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 10 Sep 2026 16:54:39 -0700 (PDT) From: Myeonghun Pak To: Zhao Qiang Cc: Krzysztof Halasa , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Alexandra Diupina , Christophe Leroy , Ijae Kim , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v3 4/4] net: wan: fsl_ucc_hdlc: release HDLC device on remove Date: Thu, 10 Sep 2026 19:54:30 -0400 Message-ID: <598d90cf55981c38288fab8c32dd52286090f384.1788128904.git.mhun512@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" ucc_hdlc_probe() registers an HDLC netdev whose private pointer refers to the separately allocated ucc_hdlc_private object. The remove path frees that object and its resources without unregistering or freeing the netdev. The registered device is left with a dangling private pointer. Unregister the HDLC device before releasing the UCC and DMA resources so an active interface is stopped first. Free the netdev before releasing its private object. This patch depends on the preceding "net: wan: hdlc: close active devices before protocol detach" fix (patch 3 of this series). Without that fix, protocol detach clears IFF_UP before unregister can invoke ndo_stop, so an active interface would not be stopped before its resources are freed. Fixes: c19b6d246a35 ("drivers/net: support hdlc function for QE-UCC") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20260803133048.42650-1-mhun512@gmail.com Link: https://lore.kernel.org/r/20260806020541.2011936-2-kuba@kernel.org Co-developed-by: Ijae Kim Signed-off-by: Ijae Kim Signed-off-by: Myeonghun Pak --- drivers/net/wan/fsl_ucc_hdlc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index 596f4ef053636..371150efc1a65 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -1255,6 +1255,8 @@ static void ucc_hdlc_remove(struct platform_device *p= dev) { struct ucc_hdlc_private *priv =3D dev_get_drvdata(&pdev->dev); =20 + unregister_hdlc_device(priv->ndev); + uhdlc_memclean(priv); =20 if (priv->utdm && priv->utdm->si_regs) { @@ -1266,6 +1268,7 @@ static void ucc_hdlc_remove(struct platform_device *p= dev) iounmap(priv->utdm->siram); priv->utdm->siram =3D NULL; } + free_netdev(priv->ndev); kfree(priv); =20 dev_info(&pdev->dev, "UCC based hdlc module removed\n"); --=20 2.47.1