From: Jarkko Nikula <jarkko.nikula@linux.intel.com>
To: linux-i3c@lists.infradead.org
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
Guruvendra Punugupati <Guruvendra.Punugupati@amd.com>,
Krishnamoorthi M <krishnamoorthi.m@amd.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>
Subject: [PATCH 1/2] i3c: mipi-i3c-hci: Mask ring interrupts before ring stop request
Date: Fri, 20 Sep 2024 17:44:31 +0300 [thread overview]
Message-ID: <20240920144432.62370-2-jarkko.nikula@linux.intel.com> (raw)
In-Reply-To: <20240920144432.62370-1-jarkko.nikula@linux.intel.com>
Bus cleanup path in DMA mode may trigger a RING_OP_STAT interrupt when
the ring is being stopped. Depending on timing between ring stop request
completion, interrupt handler removal and code execution this may lead
to a NULL pointer dereference in hci_dma_irq_handler() if it gets to run
after the io_data pointer is set to NULL in hci_dma_cleanup().
Prevent this my masking the ring interrupts before ring stop request.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
drivers/i3c/master/mipi-i3c-hci/dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i3c/master/mipi-i3c-hci/dma.c b/drivers/i3c/master/mipi-i3c-hci/dma.c
index a918e96b21fd..13adc5840094 100644
--- a/drivers/i3c/master/mipi-i3c-hci/dma.c
+++ b/drivers/i3c/master/mipi-i3c-hci/dma.c
@@ -159,10 +159,10 @@ static void hci_dma_cleanup(struct i3c_hci *hci)
for (i = 0; i < rings->total; i++) {
rh = &rings->headers[i];
+ rh_reg_write(INTR_SIGNAL_ENABLE, 0);
rh_reg_write(RING_CONTROL, 0);
rh_reg_write(CR_SETUP, 0);
rh_reg_write(IBI_SETUP, 0);
- rh_reg_write(INTR_SIGNAL_ENABLE, 0);
if (rh->xfer)
dma_free_coherent(&hci->master.dev,
--
2.45.2
--
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c
next prev parent reply other threads:[~2024-09-20 14:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-20 14:44 [PATCH 0/2] i3c: mipi-i3c-hci: DMA interrupt fixes Jarkko Nikula
2024-09-20 14:44 ` Jarkko Nikula [this message]
2024-09-20 14:44 ` [PATCH 2/2] i3c: mipi-i3c-hci: Handle interrupts according to current specifications Jarkko Nikula
2024-09-23 7:39 ` [PATCH 0/2] i3c: mipi-i3c-hci: DMA interrupt fixes Shyam Sundar S K
2024-10-31 23:06 ` Alexandre Belloni
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=20240920144432.62370-2-jarkko.nikula@linux.intel.com \
--to=jarkko.nikula@linux.intel.com \
--cc=Guruvendra.Punugupati@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=alexandre.belloni@bootlin.com \
--cc=krishnamoorthi.m@amd.com \
--cc=linux-i3c@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox