Skip to contentSkip to conversation

kernel-resource-fix-return-code-check-in-__request_free_mem_region.patch removed from -mm tree

merged [email protected] 1 participant 1 message May 18, 2021

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: kernel/resource: fix return code check in __request_free_mem_region
has been removed from the -mm tree. Its filename was
kernel-resource-fix-return-code-check-in-__request_free_mem_region.patch

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

------------------------------------------------------
From: Alistair Popple <[email protected]>
Subject: kernel/resource: fix return code check in __request_free_mem_region

Splitting an earlier version of a patch that allowed calling __request_region() while holding the resource lock into a series of patches required changing the return code for the newly introduced __request_region_locked().

Unfortunately this change was not carried through to a subsequent commit 56fd94919b8b ("kernel/resource: fix locking in request_free_mem_region") in the series. This resulted in a use-after-free due to freeing the struct resource without properly releasing it. Fix this by correcting the return code check so that the struct is not freed if the request to add it was successful.

Fixes 56fd94919b8b ("kernel/resource: fix locking in request_free_mem_region")
Cc Balbir Singh <[email protected]>
Cc Dan Williams <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Jerome Glisse <[email protected]>
Cc John Hubbard <[email protected]>
Cc Muchun Song <[email protected]>
Cc Oliver Sang <[email protected]>

---

 kernel/resource.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/resource.c renamed from kernel/resource.c~kernel-resource-fix-return-code-check-in-__request_free_mem_region +1 -1
@@ -1805,7 +1805,7 @@ static struct resource *__request_free_m
 				REGION_DISJOINT)
 			continue;
 
-		if (!__request_region_locked(res, &iomem_resource, addr, size,
+		if (__request_region_locked(res, &iomem_resource, addr, size,
 						name, 0))
 			break;
 

_

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