[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1600227737-20785-1-git-send-email-jrdr.linux@gmail.com>
Date: Wed, 16 Sep 2020 09:12:17 +0530
From: Souptick Joarder <jrdr.linux@...il.com>
To: mporter@...nel.crashing.org, alex.bou9@...il.com,
akpm@...ux-foundation.org, gustavoars@...nel.org,
jhubbard@...dia.com, madhuparnabhowmik10@...il.com,
dan.carpenter@...cle.com
Cc: linux-kernel@...r.kernel.org,
Souptick Joarder <jrdr.linux@...il.com>,
Ira Weiny <ira.weiny@...el.com>,
Matthew Wilcox <willy@...radead.org>
Subject: [linux-next PATCH] rapidio: Fix error handling path
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@...il.com>
Cc: Ira Weiny <ira.weiny@...el.com>
Cc: John Hubbard <jhubbard@...dia.com>
Cc: Matthew Wilcox <willy@...radead.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
Powered by blists - more mailing lists