Skip to contentSkip to conversation

rapidio-fix-error-handling-path.patch removed from -mm tree

merged [email protected] 1 participant 1 message Oct 16, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: rapidio: fix error handling path
has been removed from the -mm tree. Its filename was
rapidio-fix-error-handling-path.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Souptick Joarder <[email protected]>
Subject: rapidio: fix error handling path

rio_dma_transfer() attempts to clamp the return value of pin_user_pages_fast() to be >= 0. However, the attempt fails because nr_pages is overridden a few lines later, and restored to the undesirable -ERRNO value.

The return value is ultimately stored in nr_pages, which in turn is passed to unpin_user_pages(), which expects nr_pages >= 0, else, disaster.

Fix this by fixing the nesting of the assignment to nr_pages: nr_pages should be clamped to zero if pin_user_pages_fast() returns -ERRNO, or set to the return value of pin_user_pages_fast(), otherwise.

[[email protected]: new changelog]
Fixes e8de370188d09 ("rapidio: add mport char device driver")
Cc Matthew Wilcox <[email protected]>
Cc Matt Porter <[email protected]>
Cc Alexandre Bounine <[email protected]>
Cc Gustavo A. R. Silva <[email protected]>
Cc Madhuparna Bhowmik <[email protected]>
Cc Dan Carpenter <[email protected]>

---

 drivers/rapidio/devices/rio_mport_cdev.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/rapidio/devices/rio_mport_cdev.c renamed from drivers/rapidio/devices/rio_mport_cdev.c~rapidio-fix-error-handling-path +7 -6
@@ -871,15 +871,16 @@ rio_dma_transfer(struct file *filp, u32
 				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;
 		}
 

_

Patches currently in -mm which might be from [email protected] are