Skip to content

Commit bbe692e

Browse files
Navidemandersson
authored andcommitted
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>
1 parent 54ecb8f commit bbe692e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: drivers/rpmsg/rpmsg_char.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ static ssize_t rpmsg_eptdev_write_iter(struct kiocb *iocb,
227227
if (!kbuf)
228228
return -ENOMEM;
229229

230-
if (!copy_from_iter_full(kbuf, len, from))
231-
return -EFAULT;
230+
if (!copy_from_iter_full(kbuf, len, from)) {
231+
ret = -EFAULT;
232+
goto free_kbuf;
233+
}
232234

233235
if (mutex_lock_interruptible(&eptdev->ept_lock)) {
234236
ret = -ERESTARTSYS;

0 commit comments

Comments
 (0)