From aa8b8f9f9bef4696b6d9f1ca4d0de2b403db65c5 Mon Sep 17 00:00:00 2001 From: Nick Crews Date: Fri, 14 Jun 2019 14:56:31 -0600 Subject: [PATCH] platform/chrome: wilco_ec: Fix unreleased lock in event_read() When copying an event to userspace failed, the event queue lock was never released. This fixes that. Reported-by: Dan Carpenter Signed-off-by: Nick Crews Signed-off-by: Enric Balletbo i Serra --- drivers/platform/chrome/wilco_ec/event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/chrome/wilco_ec/event.c b/drivers/platform/chrome/wilco_ec/event.c index 4d2776f..1eed556 100644 --- a/drivers/platform/chrome/wilco_ec/event.c +++ b/drivers/platform/chrome/wilco_ec/event.c @@ -342,7 +342,7 @@ static ssize_t event_read(struct file *filp, char __user *buf, size_t count, struct ec_event_entry, list); n_bytes_written = entry->size; if (copy_to_user(buf, &entry->event, n_bytes_written)) - return -EFAULT; + n_bytes_written = -EFAULT; list_del(&entry->list); kfree(entry); dev_data->num_events--; -- 2.7.4