diff options
author | Navid Emamdoost <navid.emamdoost@gmail.com> | 2019-09-17 05:31:23 +0200 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2019-10-05 06:13:47 +0200 |
commit | bbe692e349e2a1edf3fe0a29a0e05899c9c94d51 (patch) | |
tree | 60c53282c3015bab2bb90b994a07e3decbcf6b13 /drivers/rpmsg | |
parent | Linux 5.4-rc1 (diff) | |
download | linux-bbe692e349e2a1edf3fe0a29a0e05899c9c94d51.tar.xz linux-bbe692e349e2a1edf3fe0a29a0e05899c9c94d51.zip |
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>
Diffstat (limited to 'drivers/rpmsg')
-rw-r--r-- | drivers/rpmsg/rpmsg_char.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index eea5ebbb5119..c655074c07c2 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -227,8 +227,10 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb, if (!kbuf) return -ENOMEM; - if (!copy_from_iter_full(kbuf, len, from)) - return -EFAULT; + if (!copy_from_iter_full(kbuf, len, from)) { + ret = -EFAULT; + goto free_kbuf; + } if (mutex_lock_interruptible(&eptdev->ept_lock)) { ret = -ERESTARTSYS; |