rpmsg: char: release allocated memory
PATCH 1/1 rpmsg: char: release allocated memory
In rpmsg_eptdev_write_iter, if copy_from_iter_full fails the allocated buffer needs to be released.
--- drivers/rpmsg/rpmsg_char.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/rpmsg/rpmsg_char.c +4 -2
@@ -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 ;
Signature · 1 line
2.17.1
Quoted 5 lines · Navid Emamdoost
In
rpmsg_eptdev_write_iter, ifcopy_from_iter_fullfails the allocated buffer needs to be released.Signed-off-by Navid Emamdoost <[email protected]>
Would you please review this patch?
Thank you,
Quoted 24 lines
--- drivers/rpmsg/rpmsg_char.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/rpmsg/rpmsg_char.c +4
-3@@ -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 ; --2.17.1
Signature · 1 line
Navid.
Quoted 10 lines · Navid Emamdoost
Quoted 5 lines · Navid Emamdoost
In
rpmsg_eptdev_write_iter, ifcopy_from_iter_fullfails the allocated buffer needs to be released.Signed-off-by Navid Emamdoost <[email protected]>Would you please review this patch?
I'm sorry, I must have missed to reply as I applied the patch. You can find it in the rpmsg-next branch [1] and it will be part of the pull request for v5.5
[1] https://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc.git/log/?h=rpmsg-next
Regards,
Bjorn
Quoted 30 lines
Thank you,
Quoted 24 lines
--- drivers/rpmsg/rpmsg_char.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/rpmsg/rpmsg_char.c +4
-3@@ -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 ; --2.17.1
Signature · 1 line
Navid.
Thanks for the update.
Quoted 53 lines · Bjorn Andersson
Quoted 10 lines · Navid Emamdoost
Quoted 5 lines · Navid Emamdoost
In
rpmsg_eptdev_write_iter, ifcopy_from_iter_fullfails the allocated buffer needs to be released.Signed-off-by Navid Emamdoost <[email protected]>Would you please review this patch?
I'm sorry, I must have missed to reply as I applied the patch. You can find it in the rpmsg-next branch [1] and it will be part of the pull request for v5.5
[1] https://git.kernel.org/pub/scm/linux/kernel/git/andersson/remoteproc.git/log/?h=rpmsg-next
Regards,
BjornQuoted 30 lines
Thank you,
Quoted 22 lines
--- drivers/rpmsg/rpmsg_char.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/rpmsg/rpmsg_char.c +4
-3@@ -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 ; --Quoted 2 lines
2.17.1
--
Navid.
Signature · 1 line
Navid.