rpmsg: unlock on error in rpmsg_eptdev_read()

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

Fixes: c0cdc19f84 ("rpmsg: Driver for user space endpoint interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Dan Carpenter 2017-01-21 07:53:40 +03:00 committed by Bjorn Andersson
parent b70ea16d2d
commit 0abd6bdde0
1 changed files with 1 additions and 2 deletions

View File

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