Skip to content

Commit

Permalink
rpmsg: unlock on error in rpmsg_eptdev_read()
Browse files Browse the repository at this point in the history
We should unlock before returning if skb_dequeue() returns a NULL.

Fixes: c0cdc19 ("rpmsg: Driver for user space endpoint interface")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
Dan Carpenter authored and andersson committed Jan 30, 2017
1 parent b70ea16 commit 0abd6bd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/rpmsg/rpmsg_char.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0abd6bd

Please sign in to comment.