Skip to contentSkip to conversation

rpmsg: unlock on error in rpmsg_eptdev_read()

PATCH New Dan Carpenter 1 participant 1 message Jan 21, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
drivers/rpmsg/rpmsg_char.c +1 -2
index a78b6b7..0ca2ccc 100644
@@ -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;