From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF16844AB91; Tue, 21 Jul 2026 21:44:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670299; cv=none; b=tqqWeDZhysDGjRGfF1XQxfCSEGVUZG5uZg7O8nQ24DbgMENrvFGvsHv4D0pbRnvNdZP3vsIE6iSGPhSisbKKpoWzYRp1wm76dCgYaXYuZUXeN95anIvD2BOGmBW3YNBnggkNWdVy31bFL6sLuSmB5sJa+CElBeJU9SoCNravAQw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784670299; c=relaxed/simple; bh=AbaAHjy/U31l5AXQ5S63854uX/PTympawm3VMeGNeNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VzpvF+1pNYAn5lrdtR27aOzt/qD4m4TMy8264XH3SVGlNVbmKCYjfMwtk2ISZ1MxAqsmkAaTqHKnkW5Hng2TQMwrLUEp+Z0pmfSVLg42AK7YIee1n+X15eHUNOs8RS9qUkEyM5p2vH31uaGdUv5FEmxQbVf+ljxgr/WxWNP4gjY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HyRXqA+o; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HyRXqA+o" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 317D51F000E9; Tue, 21 Jul 2026 21:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784670298; bh=USz90L+j56QlcqQxCg7Wi3N9ODwlqq/eK60bV2eic3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HyRXqA+ohpKwt1LZqiJiivEMXj98vqOHnzcI6JIxOWiLKO7GCMVdDAfdTaKLsqeto CRYakVujoyJ/QML6zpAKBhlf7QPv9F5g2HQPLLE11Sm2nXCGN7JrLTGGCc4iGlpoG3 1q3zYeJXJNJ+FGIDYEHG8azjo45U//3nc2LUC8gQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haoxiang Li , Linus Walleij , Jakub Kicinski Subject: [PATCH 6.1 0878/1067] net: ixp4xx_hss: fix duplicate HDLC netdev allocation Date: Tue, 21 Jul 2026 17:24:39 +0200 Message-ID: <20260721152444.173947124@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Haoxiang Li commit db818b0e8af7bac16860116a19c341a63d6677b4 upstream. ixp4xx_hss_probe() allocates two HDLC netdevs. The first one is stored in ndev, initialized, and registered with register_hdlc_device(). The second one is stored in port->netdev and later used by the remove path for unregister_hdlc_device() and free_netdev(). This means that the registered netdev is not the same object that is unregistered and freed on remove. It also leaks the first allocation if the second alloc_hdlcdev() call fails, and the first allocation is not checked before ndev is used. Older code allocated the HDLC netdev only once and stored the same object in both the local variable and port->netdev. The buggy conversion split this into two alloc_hdlcdev() calls. A later rename changed the local variable name to ndev, but the underlying mismatch remained. Fix this by allocating the HDLC netdev only once and assigning the same object to port->netdev. Fixes: 99ebe65eb9c0 ("net: ixp4xx_hss: move out assignment in if condition") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li Reviewed-by: Linus Walleij Link: https://patch.msgid.link/20260622043015.643637-1-haoxiang_li2024@163.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/wan/ixp4xx_hss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c @@ -1487,11 +1487,11 @@ static int ixp4xx_hss_probe(struct platf "unable to get CLK internal GPIO\n"); ndev = alloc_hdlcdev(port); - port->netdev = alloc_hdlcdev(port); - if (!port->netdev) { + if (!ndev) { err = -ENOMEM; goto err_plat; } + port->netdev = ndev; SET_NETDEV_DEV(ndev, &pdev->dev); hdlc = dev_to_hdlc(ndev);