Re: [PATCH] rpmsg: char: release allocated memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 16, 2019 at 10:31 PM Navid Emamdoost
<navid.emamdoost@xxxxxxxxx> wrote:
>
> 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@xxxxxxxxx>

Would you please review this patch?

Thank you,

> ---
>  drivers/rpmsg/rpmsg_char.c | 6 ++++--
>  1 file 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;
> --
> 2.17.1
>


-- 
Navid.



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux