lkml.org 
[lkml]   [2020]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [linux-next PATCH] rapidio: Fix error handling path
On Wed, Sep 16, 2020 at 09:12:17AM +0530, Souptick Joarder wrote:
> There is an error when pin_user_pages_fast() returns -ERRNO and
> inside error handling path driver end up calling unpin_user_pages()
> with -ERRNO which is not correct.
>
> This patch will fix the problem.
>
> Fixes: e8de370188d09 ("rapidio: add mport char device driver")
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Cc: Ira Weiny <ira.weiny@intel.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Matthew Wilcox <willy@infradead.org>
> ---
> drivers/rapidio/devices/rio_mport_cdev.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c
> index a303429..163b6c72 100644
> --- a/drivers/rapidio/devices/rio_mport_cdev.c
> +++ b/drivers/rapidio/devices/rio_mport_cdev.c
> @@ -871,15 +871,16 @@ static int do_dma_request(struct mport_dma_req *req,
> rmcd_error("pin_user_pages_fast err=%ld",
> pinned);
> nr_pages = 0;
> - } else
> + } else {
> rmcd_error("pinned %ld out of %ld pages",
> pinned, nr_pages);
> + /*
> + * Set nr_pages up to mean "how many pages to unpin, in
> + * the error handler:
> + */
> + nr_pages = pinned;
> + }
> ret = -EFAULT;
> - /*
> - * Set nr_pages up to mean "how many pages to unpin, in
> - * the error handler:
> - */
> - nr_pages = pinned;
> goto err_pg;
> }
>
> --
> 1.9.1
>

\
 
 \ /
  Last update: 2020-09-16 22:08    [W:1.181 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site