Skip to contentSkip to conversation

rpmsg: char: Fix missing unlock on error in rpmsg_eptdev_read()

PATCH New Wei Yongjun 1 participant 1 message Jan 23, 2017 Remote processor messaging (rpmsg)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rpmsg: char: Fix missing unlock on error in rpmsg_eptdev_read()

From: Wei Yongjun <[email protected]>

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")
---
 drivers/rpmsg/rpmsg_char.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_char.c +3 -2
index a78b6b7..93252dc 100644
@@ -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;