lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 27 Apr 2022 17:46:55 -0000
From:   "tip-bot2 for Shin'ichiro Kawasaki" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     "Shin'ichiro Kawasaki" <shinichiro.kawasaki@....com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
        stable@...r.kernel.org, x86@...nel.org,
        linux-kernel@...r.kernel.org, maz@...nel.org
Subject: [tip: irq/urgent] bus: fsl-mc-msi: Fix MSI descriptor mutex lock for
 msi_first_desc()

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     c7d2f89fea26c84d5accc55d9976dd7e5305e63a
Gitweb:        https://git.kernel.org/tip/c7d2f89fea26c84d5accc55d9976dd7e5305e63a
Author:        Shin'ichiro Kawasaki <shinichiro.kawasaki@....com>
AuthorDate:    Tue, 12 Apr 2022 16:56:36 +09:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Wed, 27 Apr 2022 19:42:32 +02:00

bus: fsl-mc-msi: Fix MSI descriptor mutex lock for msi_first_desc()

Commit e8604b1447b4 introduced a call to the helper function
msi_first_desc(), which needs MSI descriptor mutex lock before
call. However, the required mutex lock was not added. This results in
lockdep assertion:

 WARNING: CPU: 4 PID: 119 at kernel/irq/msi.c:274 msi_first_desc+0xd0/0x10c
  msi_first_desc+0xd0/0x10c
  fsl_mc_msi_domain_alloc_irqs+0x7c/0xc0
  fsl_mc_populate_irq_pool+0x80/0x3cc

Fix this by adding the mutex lock and unlock around the function call.

Fixes: e8604b1447b4 ("bus: fsl-mc-msi: Simplify MSI descriptor handling")
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@....com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
Cc: stable@...r.kernel.org
Link: https://lore.kernel.org/r/20220412075636.755454-1-shinichiro.kawasaki@wdc.com

---
 drivers/bus/fsl-mc/fsl-mc-msi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-msi.c b/drivers/bus/fsl-mc/fsl-mc-msi.c
index 5e0e439..0cfe859 100644
--- a/drivers/bus/fsl-mc/fsl-mc-msi.c
+++ b/drivers/bus/fsl-mc/fsl-mc-msi.c
@@ -224,8 +224,12 @@ int fsl_mc_msi_domain_alloc_irqs(struct device *dev,  unsigned int irq_count)
 	if (error)
 		return error;
 
+	msi_lock_descs(dev);
 	if (msi_first_desc(dev, MSI_DESC_ALL))
-		return -EINVAL;
+		error = -EINVAL;
+	msi_unlock_descs(dev);
+	if (error)
+		return error;
 
 	/*
 	 * NOTE: Calling this function will trigger the invocation of the

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ