Commit 6f8f89ce authored by Nick Crews's avatar Nick Crews Committed by Benson Leung

platform/chrome: Fix locking pattern in wilco_ec_mailbox()

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.

Fixes: 7b3d4f44 ("platform/chrome: Add new driver for Wilco EC")
Signed-off-by: default avatarNick Crews <ncrews@chromium.org>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: default avatarBenson Leung <bleung@chromium.org>
parent 27944495
...@@ -223,11 +223,11 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg) ...@@ -223,11 +223,11 @@ int wilco_ec_mailbox(struct wilco_ec_device *ec, struct wilco_ec_message *msg)
msg->command, msg->type, msg->flags, msg->response_size, msg->command, msg->type, msg->flags, msg->response_size,
msg->request_size); msg->request_size);
mutex_lock(&ec->mailbox_lock);
/* Prepare request packet */ /* Prepare request packet */
rq = ec->data_buffer; rq = ec->data_buffer;
wilco_ec_prepare(msg, rq); wilco_ec_prepare(msg, rq);
mutex_lock(&ec->mailbox_lock);
ret = wilco_ec_transfer(ec, msg, rq); ret = wilco_ec_transfer(ec, msg, rq);
mutex_unlock(&ec->mailbox_lock); mutex_unlock(&ec->mailbox_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment