mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: lee@kernel.org, Linus Walleij <linusw@kernel.org>,
	Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>,
	Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>,
	Sowjanya D <lakshmi.sowjanya.d@intel.com>,
	"Vineetha G. Jaya Kumaran" <vineetha.g.jaya.kumaran@intel.com>,
	Mark Gross <mgross@linux.intel.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 08/12] pinctrl: keembay: Check src before calling keembay_find_free_slot()
Date: Wed,  2 Dec 2026 09:30:02 +0000	[thread overview]
Message-ID: <c8236996bdd429b24733341886f1e5f01f263e0b.1796203691.git.lee@kernel.org> (raw)
In-Reply-To: <cover.1796203691.git.lee@kernel.org>

keembay_gpio_irq_enable() passes the return value of
keembay_find_free_src() straight into keembay_find_free_slot() before
checking whether src is negative.  When all interrupt sources are busy,
keembay_find_free_src() returns -EBUSY, which is implicitly converted to
a large unsigned int in keembay_find_free_slot() and causes an
out-of-bounds MMIO read.

Return early when src is negative before calling
keembay_find_free_slot().

Fixes: ffd4e739358b ("pinctrl: Add Intel Keem Bay pinctrl driver")
Closes: https://sashiko.dev/#/bug/linux-fa91d78e-0d29-4c89-ac5c-9e6a3af3096b
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
 drivers/pinctrl/pinctrl-keembay.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index cf2a81c3c2cc..78f02693b4fa 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -1375,9 +1375,11 @@ static void keembay_gpio_irq_enable(struct irq_data *data)
 
 	/* Check which Interrupt source and slot is available */
 	src = keembay_find_free_src(kpc, trig);
+	if (src < 0)
+		return;
+
 	slot = keembay_find_free_slot(kpc, src);
-
-	if (src < 0 || slot < 0)
+	if (slot < 0)
 		return;
 
 	gpiochip_enable_irq(gc, pin);
-- 
2.56.1.911.g883d8bcb20-goog


  parent reply	other threads:[~2026-12-02  9:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  9:29 [PATCH 00/12] pinctrl: Fix Critical and High issues reported by Sashiko (batch 3) Lee Jones
2026-12-02  9:29 ` [PATCH 01/12] pinctrl: stm32: Validate npins against STM32_GPIO_PINS_PER_BANK Lee Jones
2026-12-02  9:29 ` [PATCH 02/12] pinctrl: imx: Validate pin_id in imx_pinctrl_parse_pin_mmio() Lee Jones
2026-12-02  9:29 ` [PATCH 03/12] pinctrl: single: Protect group and function updates with pctldev->mutex Lee Jones
2026-12-02 14:08   ` Bartosz Golaszewski
2026-12-02  9:29 ` [PATCH 04/12] pinctrl: imx: Propagate DT parsing errors in imx_pinctrl_probe_dt() Lee Jones
2026-12-02  9:29 ` [PATCH 05/12] pinctrl: tegra: Require at least one register bank in tegra_pinctrl_probe() Lee Jones
2026-12-02  9:30 ` [PATCH 06/12] pinctrl: imx: Serialise MMIO register updates with a spinlock Lee Jones
2026-12-02  9:30 ` [PATCH 07/12] pinctrl: nuvoton: ma35: Avoid double free of shared pin configs Lee Jones
2026-12-02  9:30 ` Lee Jones [this message]
2026-12-02  9:30 ` [PATCH 09/12] pinctrl: ti: iodelay: Protect generic group addition with pctldev->mutex Lee Jones
2026-12-02  9:30 ` [PATCH 10/12] pinctrl: sunxi: Serialise per-bank regulator request and free Lee Jones
2026-12-02  9:30 ` [PATCH 11/12] pinctrl: stm32: Protect irqmux restore with hwspinlock during resume Lee Jones
2026-12-02  9:30 ` [PATCH 12/12] pinctrl: sx150x: Register threaded IRQ after adding GPIO chip Lee Jones
2026-12-02  9:35   ` Neil Armstrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8236996bdd429b24733341886f1e5f01f263e0b.1796203691.git.lee@kernel.org \
    --to=lee@kernel.org \
    --cc=lakshmi.sowjanya.d@intel.com \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=muhammad.husaini.zulkifli@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=vijayakannan.ayyathurai@intel.com \
    --cc=vineetha.g.jaya.kumaran@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®