* [PATCH] platform/chrome: Fix locking pattern in wilco_ec_mailbox()
@ 2019-03-11 15:58 Nick Crews
2019-03-12 12:15 ` Enric Balletbo i Serra
0 siblings, 1 reply; 2+ messages in thread
From: Nick Crews @ 2019-03-11 15:58 UTC (permalink / raw)
To: enric.balletbo, bleung; +Cc: linux-kernel, dlaurie, groeck, dtor, Nick Crews
Before, ec->data_buffer could be written to from multiple
contexts at the same time. Since the ec is shared data,
it needs to be inside the mutex as well.
Signed-off-by: Nick Crews <ncrews@chromium.org>
---
drivers/platform/chrome/wilco_ec/mailbox.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/chrome/wilco_ec/mailbox.c b/drivers/platform/chrome/wilco_ec/mailbox.c
index f6ff29a11f1a..d6cb96168285 100644
--- a/drivers/platform/chrome/wilco_ec/mailbox.c
+++ b/drivers/platform/chrome/wilco_ec/mailbox.c
@@ -223,12 +223,12 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
msg->command, msg->type, msg->flags, msg->response_size,
msg->request_size);
- /* Prepare request packet */
+ mutex_lock(&ec->mailbox_lock);
+
rq = ec->data_buffer;
wilco_ec_prepare(msg, rq);
-
- mutex_lock(&ec->mailbox_lock);
ret = wilco_ec_transfer(ec, msg, rq);
+
mutex_unlock(&ec->mailbox_lock);
return ret;
--
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] platform/chrome: Fix locking pattern in wilco_ec_mailbox()
2019-03-11 15:58 [PATCH] platform/chrome: Fix locking pattern in wilco_ec_mailbox() Nick Crews
@ 2019-03-12 12:15 ` Enric Balletbo i Serra
0 siblings, 0 replies; 2+ messages in thread
From: Enric Balletbo i Serra @ 2019-03-12 12:15 UTC (permalink / raw)
To: Nick Crews, bleung; +Cc: linux-kernel, dlaurie, groeck, dtor
Hi Nick,
On 11/3/19 16:58, Nick Crews wrote:
> Before, ec->data_buffer could be written to from multiple
> contexts at the same time. Since the ec is shared data,
> it needs to be inside the mutex as well.
>
Probably you're missing a fixes tag here.
> Signed-off-by: Nick Crews <ncrews@chromium.org>
> ---
> drivers/platform/chrome/wilco_ec/mailbox.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/chrome/wilco_ec/mailbox.c b/drivers/platform/chrome/wilco_ec/mailbox.c
> index f6ff29a11f1a..d6cb96168285 100644
> --- a/drivers/platform/chrome/wilco_ec/mailbox.c
> +++ b/drivers/platform/chrome/wilco_ec/mailbox.c
> @@ -223,12 +223,12 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
> msg->command, msg->type, msg->flags, msg->response_size,
> msg->request_size);
>
> - /* Prepare request packet */
There is a reason to remove this comment?
> + mutex_lock(&ec->mailbox_lock);
> +
> rq = ec->data_buffer;
> wilco_ec_prepare(msg, rq);
> -
> - mutex_lock(&ec->mailbox_lock);
> ret = wilco_ec_transfer(ec, msg, rq);
> +
Trailing whitespaces here
> mutex_unlock(&ec->mailbox_lock);
>
> return ret;
>
You don't need to resend, I'll add the fixes tag, fix the trailing whitespaces
and queue as a fix for 5.1 once the merge window closes.
Thanks,
Enric
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-12 12:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11 15:58 [PATCH] platform/chrome: Fix locking pattern in wilco_ec_mailbox() Nick Crews
2019-03-12 12:15 ` Enric Balletbo i Serra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).