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 B988B34252D; Sat, 12 Sep 2026 09:45:30 +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=1789206331; cv=none; b=XD2wc7T+alfRsIVa72Hi116AE/FwDQtNBScOE0yr5FdiXISsTXG35KxJJ2DaU/aYFId6tQhESQAn68Uj8oaVZza43b2JFVDKA9nqnYCpXrnRmgcbeAhApEVa4SXO63Kzur4DSOPEusv166rQuAmeon5oaINIeuqWeyepWyUMzrI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789206331; c=relaxed/simple; bh=CpEOS2yH2q9ZC+rRshPHppM80+ror71/P+S7LBjE8Z4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=p5fvGs8r2+oZgi4s5cUe2uNffvy8R7yhr4yV4moKhZl5bsE523P0WX1veTKw13zsVLOtnOM8q2nAKHJbKquH2cIZD4FH3TM6jiQNuGrwZaMmaO9Lz0a73BhISdX7agmfFYWOHADMKKcRC5rPk787aJpi9sSvl/deawlXccPhqMo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HQmvwRZ+; 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="HQmvwRZ+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71F421F000FF; Sat, 12 Sep 2026 09:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789206330; bh=wXNeK8MUPq4Xsa67hL/MP/gjD09TRUGMjkbeOgsYF+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HQmvwRZ+daMn74PRHaUHCVoWs5t84lanAu7sacUEpVx8uEarUL//ObmmAO/3+jSZ+ iH66jgOLZsJItJTNSgle1EMRKTMA2DkX9ySBTqJBqZVjuCNrNIv0rGNaYByv6LtMSE 7e8UGYGYGnbi/XJQychuRD8yyjiLrxkyQRHvuUNE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniel McCarthy , Linus Walleij , Sasha Levin Subject: [PATCH 6.18 0143/1518] pinctrl: bcm2835: Dont remove an unregistered GPIO chip Date: Sat, 12 Sep 2026 08:38:32 +0200 Message-ID: <20260912065626.728022137@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065623.398859879@linuxfoundation.org> References: <20260912065623.398859879@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel McCarthy [ Upstream commit 32711f77db0641e57fd96fdc013bf1286b9f2514 ] If the devm_pinctrl_register() function fails, bcm2835_pinctrl_probe() calls gpiochip_remove() before gpiochip_add_data() has registered the GPIO chip. This means that upon failure the gpio_chip.gpiodev is NULL resulting in a null pointer dereference inside the gpiochip_remove() function. Remove the unnecessary function call to gpiochip_remove(). No GPIO cleanup is required because the GPIO chip has not yet been registered. Without this change there is potential for a kernel panic upon registration failure Fixes: 266423e60ea1 ("pinctrl: bcm2835: Change init order for gpio hogs") Signed-off-by: Daniel McCarthy Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index c165674c5b4db..bda4273138ff3 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -1351,7 +1351,6 @@ static int bcm2835_pinctrl_probe(struct platform_device *pdev) pc->pctl_desc = *pdata->pctl_desc; pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); if (IS_ERR(pc->pctl_dev)) { - gpiochip_remove(&pc->gpio_chip); return PTR_ERR(pc->pctl_dev); } -- 2.53.0