rpmsg: char: release allocated memory

In rpmsg_eptdev_write_iter, if copy_from_iter_full fails the allocated
buffer needs to be released.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Navid Emamdoost 2019-09-16 22:31:23 -05:00 committed by Bjorn Andersson
parent 54ecb8f702
commit bbe692e349
1 changed files with 4 additions and 2 deletions

View File

@ -227,8 +227,10 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb,
if (!kbuf) if (!kbuf)
return -ENOMEM; return -ENOMEM;
if (!copy_from_iter_full(kbuf, len, from)) if (!copy_from_iter_full(kbuf, len, from)) {
return -EFAULT; ret = -EFAULT;
goto free_kbuf;
}
if (mutex_lock_interruptible(&eptdev->ept_lock)) { if (mutex_lock_interruptible(&eptdev->ept_lock)) {
ret = -ERESTARTSYS; ret = -ERESTARTSYS;