]> git.hungrycats.org Git - linux/commit
gpio: mt7621: avoid corruption of shared interrupt trigger state
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Fri, 26 Jun 2026 06:01:09 +0000 (08:01 +0200)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 30 Jun 2026 14:36:34 +0000 (16:36 +0200)
commit1781172526d1092323af443fa03f00e6de560401
treed4fe4c145870517a2889781870a035f1cd1beccb
parentefecde8a254d1f207b75c5ebcfba2c51f4c771d9
gpio: mt7621: avoid corruption of shared interrupt trigger state

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 <sashiko-bot@kernel.org>
Fixes: 4ba9c3afda41 ("gpio: mt7621: Add a driver for MT7621")
Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://patch.msgid.link/20260626060112.2498324-2-sergio.paracuellos@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-mt7621.c