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 65C963385A5 for ; Tue, 28 Jul 2026 15:52:31 +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=1785253953; cv=none; b=l0F0+d7Zvshp/uQ/ZQVWCMzx/RotKph5eDoJzZODZRdCcz24NSD2k67Q1wisrNfObKABCeJKNkzh449NATvSqeg4P23Tn/tpm1Xp0ib6GLqB7yJ2wvCPdvPUMP5rgwPj658PY+mtEJmNBs0+1AWxo0u8EpLQu1OMSbdxT1ZoPIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785253953; c=relaxed/simple; bh=7lzBBpKl525xbuAgJ6D4I67MvimynDIy4ayRioThEbU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KB6pKAuOW47URp6TJWEQBZfVV3PHGxmG7IZYJrbzovjj85LOicwyiDKKkSJBiq9S4Xb3wyVQk89wiRj5rnROEkZ1EJLZ+SL6Rw//KVxQ39fjfb18H0VO0qgKSGYKF2DBlbwQWNHaJe+3wYPfLwuOIaWdo8zmXDCnHTK7cJCwTec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dBOEkVCz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dBOEkVCz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 569A31F000E9; Tue, 28 Jul 2026 15:52:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785253951; bh=0rhgh2pkY+6/FnbhaTKn2z4bPTLKFol613zVJTSkcYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dBOEkVCzdzchpHGgS0Xl7ovAnkF/164befVuJkZgK5pzDhLf16970GbzNJfNf3YZO Uk0iXmDwGFlcXYgUjX1CyEO2aHy72u02bCk8tTJ+X5REPEiFbE22awZcopoRgM/HDJ 0tFeftBppEwl4DVaShUJ6eV2kUteA6J2tYOdr8Gd2W3KY0y5R42Xp7qVHT29JDE1P2 alC+5o6aVh+7KfUdrBPGIn1F+7Nu73StJ0JuDRRYJ7JMHHoocJlQgQ8qkFTd29/MN3 RJhF27n7MonzBwecoCUxx8Cg0HIq/dNEbYqTRJvHvqyEcfOPN7kvIFd1nNhCEZ4r9H UG4ZwZu0Ktg/g== From: Sasha Levin To: stable@vger.kernel.org Cc: Sergio Paracuellos , Sashiko , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 6.6.y] gpio: mt7621: avoid corruption of shared interrupt trigger state Date: Tue, 28 Jul 2026 11:52:28 -0400 Message-ID: <20260728155228.8665-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026072038-unwelcome-pebbly-862d@gregkh> References: <2026072038-unwelcome-pebbly-862d@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Sergio Paracuellos [ Upstream commit 1781172526d1092323af443fa03f00e6de560401 ] The bank-shared fields like 'rising' and 'falling' are modified using non-atomic read-modify-write operations. Since every gpio chip instance represents an entire bank of 32 pins, if 'mediatek_gpio_irq_type()' is called concurrently for different IRQs on the same bank a possible overwrite of each other's configuration is possible. Thus, protect this state with 'gpio_generic_lock_irqsave' lock in the same way it is handled in irp_chip 'mediatek_gpio_irq_mask()' and 'mediatek_gpio_irq_unmask()' callbacks. Cc: stable@vger.kernel.org Reported-by: Sashiko Fixes: 4ba9c3afda41 ("gpio: mt7621: Add a driver for MT7621") Signed-off-by: Sergio Paracuellos Link: https://patch.msgid.link/20260626060112.2498324-2-sergio.paracuellos@gmail.com Signed-off-by: Bartosz Golaszewski [ Changed `guard(gpio_generic_lock_irqsave)(&rg->chip)` to `guard(spinlock_irqsave)(&rg->lock)` as the generic GPIO chip lock does not exist in this tree. ] Signed-off-by: Sasha Levin --- drivers/gpio/gpio-mt7621.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpio/gpio-mt7621.c b/drivers/gpio/gpio-mt7621.c index 93facbebb80efa..212a5f57cfd2bd 100644 --- a/drivers/gpio/gpio-mt7621.c +++ b/drivers/gpio/gpio-mt7621.c @@ -156,6 +156,8 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int type) int pin = d->hwirq; u32 mask = BIT(pin); + guard(spinlock_irqsave)(&rg->lock); + if (type == IRQ_TYPE_PROBE) { if ((rg->rising | rg->falling | rg->hlevel | rg->llevel) & mask) -- 2.53.0