提交 0abd6bdd 编写于 作者: D Dan Carpenter 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册