All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] rpmsg: char: Fix missing unlock on error in rpmsg_eptdev_read()
@ 2017-01-23 14:09 Wei Yongjun
  0 siblings, 0 replies; only message in thread
From: Wei Yongjun @ 2017-01-23 14:09 UTC (permalink / raw)
  To: Ohad Ben-Cohen, Bjorn Andersson; +Cc: Wei Yongjun, linux-remoteproc

From: Wei Yongjun <weiyongjun1@huawei.com>

Add the missing unlock before return from function rpmsg_eptdev_read()
in the error handling case.

Fixes: c0cdc19f84a4 ("rpmsg: Driver for user space endpoint interface")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/rpmsg/rpmsg_char.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c
index a78b6b7..93252dc 100644
--- a/drivers/rpmsg/rpmsg_char.c
+++ b/drivers/rpmsg/rpmsg_char.c
@@ -209,11 +209,12 @@ static ssize_t rpmsg_eptdev_read(struct file *filp, char __user *buf,
 	}
 
 	skb = skb_dequeue(&eptdev->queue);
-	if (!skb)
-		return -EFAULT;
 
 	spin_unlock_irqrestore(&eptdev->queue_lock, flags);
 
+	if (!skb)
+		return -EFAULT;
+
 	use = min_t(size_t, len, skb->len);
 	if (copy_to_user(buf, skb->data, use))
 		use = -EFAULT;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-23 14:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 14:09 [PATCH -next] rpmsg: char: Fix missing unlock on error in rpmsg_eptdev_read() Wei Yongjun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.