Commit 0abd6bdd authored by Dan Carpenter's avatar Dan Carpenter Committed by Bjorn Andersson

rpmsg: unlock on error in rpmsg_eptdev_read()

We should unlock before returning if skb_dequeue() returns a NULL.

Fixes: c0cdc19f ("rpmsg: Driver for user space endpoint interface")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent b70ea16d
......@@ -209,11 +209,10 @@ static ssize_t rpmsg_eptdev_read(struct file *filp, char __user *buf,
}
skb = skb_dequeue(&eptdev->queue);
spin_unlock_irqrestore(&eptdev->queue_lock, flags);
if (!skb)
return -EFAULT;
spin_unlock_irqrestore(&eptdev->queue_lock, flags);
use = min_t(size_t, len, skb->len);
if (copy_to_user(buf, skb->data, use))
use = -EFAULT;
......
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