[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250411-mailbox-cleanup-v1-2-8db541394dc2@nxp.com>
Date: Fri, 11 Apr 2025 21:14:10 +0800
From: "Peng Fan (OSS)" <peng.fan@....nxp.com>
To: Jassi Brar <jassisinghbrar@...il.com>
Cc: Tudor Ambarus <tudor.ambarus@...aro.org>,
Elliot Berman <quic_eberman@...cinc.com>,
Thierry Reding <treding@...dia.com>, Sudeep Holla <sudeep.holla@....com>,
linux-kernel@...r.kernel.org, mailbox@...ts.linux.dev,
Peng Fan <peng.fan@....com>
Subject: [PATCH 2/6] mailbox: Not protect module_put with spin_lock_irqsave
From: Peng Fan <peng.fan@....com>
&chan->lock is not supposed to protect 'chan->mbox'.
And in __mbox_bind_client, try_module_get is also not protected
by &chan->lock. So move module_put out of the lock protected
region.
Signed-off-by: Peng Fan <peng.fan@....com>
---
drivers/mailbox/mailbox.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mailbox/mailbox.c b/drivers/mailbox/mailbox.c
index e5e2a66355a712e71a92e4ad339e99d7ff8e34be..3ecf92a580fef031d8add5e4c2e4df494a34010a 100644
--- a/drivers/mailbox/mailbox.c
+++ b/drivers/mailbox/mailbox.c
@@ -486,8 +486,8 @@ void mbox_free_channel(struct mbox_chan *chan)
if (chan->txdone_method == TXDONE_BY_ACK)
chan->txdone_method = TXDONE_BY_POLL;
- module_put(chan->mbox->dev->driver->owner);
spin_unlock_irqrestore(&chan->lock, flags);
+ module_put(chan->mbox->dev->driver->owner);
}
EXPORT_SYMBOL_GPL(mbox_free_channel);
--
2.37.1
Powered by blists - more mailing lists