summaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-01-21 07:53:40 +0300
committerBjorn Andersson <bjorn.andersson@linaro.org>2017-01-30 13:20:24 -0800
commit0abd6bdde04f3f7e9a1b76d474f3d9e804ef1867 (patch)
tree7400ddfaf6948eaf48e1e3a8a5bd83438090a48c /drivers/rpmsg
parentb70ea16d2d55db5d4b59d615d002046647e49a1e (diff)
downloadlinux-0abd6bdde04f3f7e9a1b76d474f3d9e804ef1867.tar.bz2
rpmsg: unlock on error in rpmsg_eptdev_read()
We should unlock before returning if skb_dequeue() returns a NULL. Fixes: c0cdc19f84a4 ("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>
Diffstat (limited to 'drivers/rpmsg')
-rw-r--r--drivers/rpmsg/rpmsg_char.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index a78b6b79cea4..0ca2ccc09ca6 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -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;