Skip to contentSkip to conversation

+ rapidio-fix-use-after-free-in-rio_unregister_scan.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Jul 11, 2013 Rapidio

lore
Share & tools
lore
#0 lore raw

Subject: + rapidio-fix-use-after-free-in-rio_unregister_scan.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Thu, 11 Jul 2013 15:04:32 -0700

The patch titled
Subject: rapidio: fix use after free in rio_unregister_scan()
has been added to the -mm tree. Its filename is
rapidio-fix-use-after-free-in-rio_unregister_scan.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/rapidio-fix-use-after-free-in-rio_unregister_scan.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/rapidio-fix-use-after-free-in-rio_unregister_scan.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Dan Carpenter <[email protected]>
Subject: rapidio: fix use after free in rio_unregister_scan()

We're freeing the list iterator so we can't move to the next entry. Since there is only one matching mport_id, we can just break after finding it.

---

 drivers/rapidio/rio.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/rapidio/rio.c renamed from drivers/rapidio/rio.c~rapidio-fix-use-after-free-in-rio_unregister_scan +3 -1
diff -puN drivers/rapidio/rio.c~rapidio-fix-use-after-free-in-rio_unregister_scan drivers/rapidio/rio.c
@@ -1715,11 +1715,13 @@ int rio_unregister_scan(int mport_id, st
 		    (mport_id == RIO_MPORT_ANY && port->nscan == scan_ops))
 			port->nscan = NULL;
 
-	list_for_each_entry(scan, &rio_scans, node)
+	list_for_each_entry(scan, &rio_scans, node) {
 		if (scan->mport_id == mport_id) {
 			list_del(&scan->node);
 			kfree(scan);
+			break;
 		}
+	}
 
 	mutex_unlock(&rio_mport_list_lock);
 

_

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

origin.patch
linux-next.patch rapidio-fix-use-after-free-in-rio_unregister_scan.patch fs-convert-fs-shrinkers-to-new-scan-count-api-fix-fix.patch