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 <dan.carpenter@oracle.com>
Signed-off-by: Nick Crews <ncrews@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
This commit is contained in:
Nick Crews 2019-06-14 14:56:31 -06:00 committed by Enric Balletbo i Serra
parent 35b52b3315
commit aa8b8f9f9b

View File

@ -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--;