All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Shin'ichiro Kawasaki" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: "Shin'ichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	stable@vger.kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, maz@kernel.org
Subject: [tip: irq/urgent] bus: fsl-mc-msi: Fix MSI descriptor mutex lock for msi_first_desc()
Date: Wed, 27 Apr 2022 17:46:55 -0000	[thread overview]
Message-ID: <165108161560.4207.6285834000819152880.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20220412075636.755454-1-shinichiro.kawasaki@wdc.com>

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@wdc.com>
AuthorDate:    Tue, 12 Apr 2022 16:56:36 +09:00
Committer:     Thomas Gleixner <tglx@linutronix.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@wdc.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Cc: stable@vger.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

      parent reply	other threads:[~2022-04-27 17:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12  7:56 [PATCH v2] bus: fsl-mc-msi: fix MSI descriptor mutex lock for msi_first_desc() Shin'ichiro Kawasaki
2022-04-27 10:38 ` Shinichiro Kawasaki
2022-04-27 17:38   ` Thomas Gleixner
2022-04-27 17:46 ` tip-bot2 for Shin'ichiro Kawasaki [this message]

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=165108161560.4207.6285834000819152880.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=shinichiro.kawasaki@wdc.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.