From: "Maciej S. Szmigiero" <mail(a)maciej.szmigiero.name>
[ Upstream commit dd410d784402c5775f66faf8b624e85e41c38aaf ]
Wakeup for IRQ1 should be disabled only in cases where i8042 had
actually enabled it, otherwise "wake_depth" for this IRQ will try to
drop below zero and there will be an unpleasant WARN() logged:
kernel: atkbd serio0: Disabling IRQ1 wakeup source to avoid platform firmware bug
kernel: ------------[ cut here ]------------
kernel: Unbalanced IRQ 1 wake disable
kernel: WARNING: CPU: 10 PID: 6431 at kernel/irq/manage.c:920 irq_set_irq_wake+0x147/0x1a0
The PMC driver uses DEFINE_SIMPLE_DEV_PM_OPS() to define its dev_pm_ops
which sets amd_pmc_suspend_handler() to the .suspend, .freeze, and
.poweroff handlers. i8042_pm_suspend(), however, is only set as
the .suspend handler.
Fix the issue by call PMC suspend handler only from the same set of
dev_pm_ops handlers as i8042_pm_suspend(), which currently means just
the .suspend handler.
To reproduce this issue try hibernating (S4) the machine after a fresh boot
without putting it into s2idle first.
Fixes: 8e60615e8932 ("platform/x86/amd: pmc: Disable IRQ1 wakeup for RN/CZN")
Reviewed-by: Mario Limonciello <mario.limonciello(a)amd.com>
Signed-off-by: Maciej S. Szmigiero <mail(a)maciej.szmigiero.name>
Link: https://lore.kernel.org/r/c8f28c002ca3c66fbeeb850904a1f43118e17200.17361846…
[ij: edited the commit message.]
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen(a)linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen(a)linux.intel.com>
Signed-off-by: Zhaoyang Li <lizy04(a)hust.edu.cn>
---
drivers/platform/x86/amd/pmc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/amd/pmc.c b/drivers/platform/x86/amd/pmc.c
index f237c1ea8d35..8eaeb1e8f975 100644
--- a/drivers/platform/x86/amd/pmc.c
+++ b/drivers/platform/x86/amd/pmc.c
@@ -834,6 +834,10 @@ static int __maybe_unused amd_pmc_suspend_handler(struct device *dev)
{
struct amd_pmc_dev *pdev = dev_get_drvdata(dev);
+ /*
+ * Must be called only from the same set of dev_pm_ops handlers
+ * as i8042_pm_suspend() is called: currently just from .suspend.
+ */
if (pdev->cpu_id == AMD_CPU_ID_CZN) {
int rc = amd_pmc_czn_wa_irq1(pdev);
@@ -846,7 +850,9 @@ static int __maybe_unused amd_pmc_suspend_handler(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(amd_pmc_pm, amd_pmc_suspend_handler, NULL);
+static const struct dev_pm_ops amd_pmc_pm = {
+ .suspend = amd_pmc_suspend_handler,
+};
#endif
--
2.25.1
This is the start of the stable review cycle for the 5.15.183 release.
There are 54 patches in this series, all will be posted as a response
to this one. If anyone has any issues with these being applied, please
let me know.
Responses should be made by Wed, 14 May 2025 17:19:58 +0000.
Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.15.183-r…
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-5.15.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Linux 5.15.183-rc1
Pawan Gupta <pawan.kumar.gupta(a)linux.intel.com>
x86/bhi: Do not set BHI_DIS_S in 32-bit mode
Daniel Sneddon <daniel.sneddon(a)linux.intel.com>
x86/bpf: Add IBHF call at end of classic BPF
Daniel Sneddon <daniel.sneddon(a)linux.intel.com>
x86/bpf: Call branch history clearing sequence on exit
Greg Kroah-Hartman <gregkh(a)linuxfoundation.org>
Revert "net: phy: microchip: force IRQ polling mode for lan88xx"
Al Viro <viro(a)zeniv.linux.org.uk>
do_umount(): add missing barrier before refcount checks in sync case
Daniel Wagner <wagi(a)kernel.org>
nvme: unblock ctrl state transition for firmware update
Kevin Baker <kevinb(a)ventureresearch.com>
drm/panel: simple: Update timings for AUO G101EVN010
Thorsten Blum <thorsten.blum(a)linux.dev>
MIPS: Fix MAX_REG_OFFSET
Jonathan Cameron <Jonathan.Cameron(a)huawei.com>
iio: adc: dln2: Use aligned_s64 for timestamp
Andy Shevchenko <andriy.shevchenko(a)linux.intel.com>
types: Complement the aligned types with signed 64-bit one
Dave Penkler <dpenkler(a)gmail.com>
usb: usbtmc: Fix erroneous generic_read ioctl return
Dave Penkler <dpenkler(a)gmail.com>
usb: usbtmc: Fix erroneous wait_srq ioctl return
Dave Penkler <dpenkler(a)gmail.com>
usb: usbtmc: Fix erroneous get_stb ioctl error returns
Oliver Neukum <oneukum(a)suse.com>
USB: usbtmc: use interruptible sleep in usbtmc_read
Andrei Kuchynski <akuchynski(a)chromium.org>
usb: typec: ucsi: displayport: Fix NULL pointer access
RD Babiera <rdbabiera(a)google.com>
usb: typec: tcpm: delay SNK_TRY_WAIT_DEBOUNCE to SRC_TRYWAIT transition
Jim Lin <jilin(a)nvidia.com>
usb: host: tegra: Prevent host controller crash when OTG port is used
Wayne Chang <waynec(a)nvidia.com>
usb: gadget: tegra-xudc: ACK ST_RC after clearing CTRL_RUN
Pawel Laszczak <pawell(a)cadence.com>
usb: cdnsp: fix L1 resume issue for RTL_REVISION_NEW_LPM version
Pawel Laszczak <pawell(a)cadence.com>
usb: cdnsp: Fix issue with resuming from L1
Jan Kara <jack(a)suse.cz>
ocfs2: stop quota recovery before disabling quotas
Jan Kara <jack(a)suse.cz>
ocfs2: implement handshaking with ocfs2 recovery thread
Jan Kara <jack(a)suse.cz>
ocfs2: switch osb->disable_recovery to enum
Dmitry Antipov <dmantipov(a)yandex.ru>
module: ensure that kobject_put() is safe for module type kobjects
Jason Andryuk <jason.andryuk(a)amd.com>
xenbus: Use kref to track req lifetime
Alexey Charkov <alchark(a)gmail.com>
usb: uhci-platform: Make the clock really optional
Wayne Lin <Wayne.Lin(a)amd.com>
drm/amd/display: Fix wrong handling for AUX_DEFER case
Silvano Seva <s.seva(a)4sigma.it>
iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_tagged_fifo
Silvano Seva <s.seva(a)4sigma.it>
iio: imu: st_lsm6dsx: fix possible lockup in st_lsm6dsx_read_fifo
Gabriel Shahrouzi <gshahrouzi(a)gmail.com>
iio: adis16201: Correct inclinometer channel resolution
Angelo Dureghello <adureghello(a)baylibre.com>
iio: adc: ad7606: fix serial register access
Dave Hansen <dave.hansen(a)linux.intel.com>
x86/mm: Eliminate window where TLB flushes may be inadvertently skipped
Gabriel Shahrouzi <gshahrouzi(a)gmail.com>
staging: axis-fifo: Correct handling of tx_fifo_depth for size validation
Gabriel Shahrouzi <gshahrouzi(a)gmail.com>
staging: axis-fifo: Remove hardware resets for user errors
Gabriel Shahrouzi <gshahrouzi(a)gmail.com>
staging: iio: adc: ad7816: Correct conditional logic for store mode
Aditya Garg <gargaditya08(a)live.com>
Input: synaptics - enable InterTouch on TUXEDO InfinityBook Pro 14 v5
Dmitry Torokhov <dmitry.torokhov(a)gmail.com>
Input: synaptics - enable SMBus for HP Elitebook 850 G1
Aditya Garg <gargaditya08(a)live.com>
Input: synaptics - enable InterTouch on Dell Precision M3800
Aditya Garg <gargaditya08(a)live.com>
Input: synaptics - enable InterTouch on Dynabook Portege X30L-G
Manuel Fombuena <fombuena(a)outlook.com>
Input: synaptics - enable InterTouch on Dynabook Portege X30-D
Jonas Gorski <jonas.gorski(a)gmail.com>
net: dsa: b53: fix learning on VLAN unaware bridges
Jonas Gorski <jonas.gorski(a)gmail.com>
net: dsa: b53: always rejoin default untagged VLAN on bridge leave
Jonas Gorski <jonas.gorski(a)gmail.com>
net: dsa: b53: fix VLAN ID for untagged vlan on bridge leave
Jonas Gorski <jonas.gorski(a)gmail.com>
net: dsa: b53: fix flushing old pvid VLAN on pvid change
Jonas Gorski <jonas.gorski(a)gmail.com>
net: dsa: b53: fix clearing PVID of a port
Jonas Gorski <jonas.gorski(a)gmail.com>
net: dsa: b53: allow leaky reserved multicast
Jozsef Kadlecsik <kadlec(a)netfilter.org>
netfilter: ipset: fix region locking in hash types
Oliver Hartkopp <socketcan(a)hartkopp.net>
can: gw: fix RCU/BH usage in cgw_create_job()
Uladzislau Rezki (Sony) <urezki(a)gmail.com>
rcu/kvfree: Add kvfree_rcu_mightsleep() and kfree_rcu_mightsleep()
Eric Dumazet <edumazet(a)google.com>
can: gw: use call_rcu() instead of costly synchronize_rcu()
Guillaume Nault <gnault(a)redhat.com>
gre: Fix again IPv6 link-local address generation.
Eelco Chaudron <echaudro(a)redhat.com>
openvswitch: Fix unsafe attribute parsing in output_userspace()
Marc Kleine-Budde <mkl(a)pengutronix.de>
can: mcp251xfd: mcp251xfd_remove(): fix order of unregistration calls
Marc Kleine-Budde <mkl(a)pengutronix.de>
can: mcan: m_can_class_unregister(): fix order of unregistration calls
-------------
Diffstat:
Makefile | 4 +-
arch/mips/include/asm/ptrace.h | 3 +-
arch/x86/kernel/cpu/bugs.c | 5 +-
arch/x86/kernel/cpu/common.c | 9 +-
arch/x86/mm/tlb.c | 23 ++-
arch/x86/net/bpf_jit_comp.c | 52 +++++++
.../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 28 +++-
drivers/gpu/drm/panel/panel-simple.c | 25 +--
drivers/iio/accel/adis16201.c | 4 +-
drivers/iio/adc/ad7606_spi.c | 2 +-
drivers/iio/adc/dln2-adc.c | 2 +-
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 6 +
drivers/input/mouse/synaptics.c | 5 +
drivers/net/can/m_can/m_can.c | 2 +-
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 2 +-
drivers/net/dsa/b53/b53_common.c | 36 +++--
drivers/net/phy/microchip.c | 46 +++++-
drivers/nvme/host/core.c | 3 +-
drivers/staging/axis-fifo/axis-fifo.c | 14 +-
drivers/staging/iio/adc/ad7816.c | 2 +-
drivers/usb/cdns3/cdnsp-gadget.c | 31 ++++
drivers/usb/cdns3/cdnsp-gadget.h | 6 +
drivers/usb/cdns3/cdnsp-pci.c | 12 +-
drivers/usb/cdns3/cdnsp-ring.c | 3 +-
drivers/usb/cdns3/core.h | 3 +
drivers/usb/class/usbtmc.c | 59 +++++---
drivers/usb/gadget/udc/tegra-xudc.c | 4 +
drivers/usb/host/uhci-platform.c | 2 +-
drivers/usb/host/xhci-tegra.c | 3 +
drivers/usb/typec/tcpm/tcpm.c | 2 +-
drivers/usb/typec/ucsi/displayport.c | 2 +
drivers/xen/xenbus/xenbus.h | 2 +
drivers/xen/xenbus/xenbus_comms.c | 9 +-
drivers/xen/xenbus/xenbus_dev_frontend.c | 2 +-
drivers/xen/xenbus/xenbus_xs.c | 18 ++-
fs/namespace.c | 3 +-
fs/ocfs2/journal.c | 80 +++++++---
fs/ocfs2/journal.h | 1 +
fs/ocfs2/ocfs2.h | 17 ++-
fs/ocfs2/quota_local.c | 9 +-
fs/ocfs2/super.c | 3 +
include/linux/rcupdate.h | 3 +
include/linux/types.h | 3 +-
include/uapi/linux/types.h | 1 +
kernel/params.c | 4 +-
net/can/gw.c | 167 +++++++++++++--------
net/ipv6/addrconf.c | 15 +-
net/netfilter/ipset/ip_set_hash_gen.h | 2 +-
net/openvswitch/actions.c | 3 +-
49 files changed, 538 insertions(+), 204 deletions(-)
Fix a potential deadlock bug. Observe that in the mtk-cqdma.c
file, functions like mtk_cqdma_issue_pending() and
mtk_cqdma_free_active_desc() properly acquire the pc lock before the vc
lock when handling pc and vc fields. However, mtk_cqdma_tx_status()
violates this order by first acquiring the vc lock before invoking
mtk_cqdma_find_active_desc(), which subsequently takes the pc lock. This
reversed locking sequence (vc → pc) contradicts the established
pc → vc order and creates deadlock risks.
Fix the issue by moving the vc lock acquisition code from
mtk_cqdma_find_active_desc() to mtk_cqdma_tx_status(). Ensure the pc lock
is acquired before the vc lock in the calling function to maintain correct
locking hierarchy. Note that since mtk_cqdma_find_active_desc() is a
static function with only one caller (mtk_cqdma_tx_status()), this
modification safely eliminates the deadlock possibility without affecting
other components.
This possible bug is found by an experimental static analysis tool
developed by our team. This tool analyzes the locking APIs to extract
function pairs that can be concurrently executed, and then analyzes the
instructions in the paired functions to identify possible concurrency bugs
including deadlocks, data races and atomicity violations.
Fixes: b1f01e48df5a ("dmaengine: mediatek: Add MediaTek Command-Queue DMA controller for MT6765 SoC")
Cc: stable(a)vger.kernel.org
Signed-off-by: Qiu-ji Chen <chenqiuji666(a)gmail.com>
---
V2:
Revised the fix approach and updated the description to address the
reduced protection scope of the vc lock in the V1 solution.
---
drivers/dma/mediatek/mtk-cqdma.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/dma/mediatek/mtk-cqdma.c b/drivers/dma/mediatek/mtk-cqdma.c
index d5ddb4e30e71..e35271ac1eed 100644
--- a/drivers/dma/mediatek/mtk-cqdma.c
+++ b/drivers/dma/mediatek/mtk-cqdma.c
@@ -422,13 +422,10 @@ static struct virt_dma_desc *mtk_cqdma_find_active_desc(struct dma_chan *c,
struct virt_dma_desc *vd;
unsigned long flags;
- spin_lock_irqsave(&cvc->pc->lock, flags);
list_for_each_entry(vd, &cvc->pc->queue, node)
if (vd->tx.cookie == cookie) {
- spin_unlock_irqrestore(&cvc->pc->lock, flags);
return vd;
}
- spin_unlock_irqrestore(&cvc->pc->lock, flags);
list_for_each_entry(vd, &cvc->vc.desc_issued, node)
if (vd->tx.cookie == cookie)
@@ -452,9 +449,11 @@ static enum dma_status mtk_cqdma_tx_status(struct dma_chan *c,
if (ret == DMA_COMPLETE || !txstate)
return ret;
+ spin_lock_irqsave(&cvc->pc->lock, flags);
spin_lock_irqsave(&cvc->vc.lock, flags);
vd = mtk_cqdma_find_active_desc(c, cookie);
spin_unlock_irqrestore(&cvc->vc.lock, flags);
+ spin_unlock_irqrestore(&cvc->pc->lock, flags);
if (vd) {
cvd = to_cqdma_vdesc(vd);
--
2.34.1