* [PATCH] iommu: fix KASAN use-after-free in iommu_insert_resv_region
@ 2019-11-25 10:35 ` Eric Auger
0 siblings, 0 replies; 2+ messages in thread
From: Eric Auger @ 2019-11-25 10:35 UTC (permalink / raw)
To: eric.auger.pro, eric.auger, joro, hch, cai, iommu, linux-kernel
Store the new region type in a variable. In case the new region
gets merged into another one, the new node is freed and nr shall
not be used anymore.
Fixes: 4dbd258ff63e ("iommu: Revisit iommu_insert_resv_region()
implementation")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Qian Cai <cai@lca.pw>
CC: Stable <stable@vger.kernel.org> #v5.3+
---
drivers/iommu/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index d658c7c6a2ab..338769f96d17 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -293,6 +293,8 @@ int iommu_insert_resv_region(struct iommu_resv_region *new,
struct list_head *regions)
{
struct iommu_resv_region *iter, *tmp, *nr, *top;
+ enum iommu_resv_type nr_type = new->type;
+
LIST_HEAD(stack);
nr = iommu_alloc_resv_region(new->start, new->length,
@@ -313,7 +315,7 @@ int iommu_insert_resv_region(struct iommu_resv_region *new,
phys_addr_t top_end, iter_end = iter->start + iter->length - 1;
/* no merge needed on elements of different types than @nr */
- if (iter->type != nr->type) {
+ if (iter->type != nr_type) {
list_move_tail(&iter->list, &stack);
continue;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] iommu: fix KASAN use-after-free in iommu_insert_resv_region
@ 2019-11-25 10:35 ` Eric Auger
0 siblings, 0 replies; 2+ messages in thread
From: Eric Auger @ 2019-11-25 10:35 UTC (permalink / raw)
To: eric.auger.pro, eric.auger, joro, hch, cai, iommu, linux-kernel
Store the new region type in a variable. In case the new region
gets merged into another one, the new node is freed and nr shall
not be used anymore.
Fixes: 4dbd258ff63e ("iommu: Revisit iommu_insert_resv_region()
implementation")
Signed-off-by: Eric Auger <eric.auger@redhat.com>
Reported-by: Qian Cai <cai@lca.pw>
CC: Stable <stable@vger.kernel.org> #v5.3+
---
drivers/iommu/iommu.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index d658c7c6a2ab..338769f96d17 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -293,6 +293,8 @@ int iommu_insert_resv_region(struct iommu_resv_region *new,
struct list_head *regions)
{
struct iommu_resv_region *iter, *tmp, *nr, *top;
+ enum iommu_resv_type nr_type = new->type;
+
LIST_HEAD(stack);
nr = iommu_alloc_resv_region(new->start, new->length,
@@ -313,7 +315,7 @@ int iommu_insert_resv_region(struct iommu_resv_region *new,
phys_addr_t top_end, iter_end = iter->start + iter->length - 1;
/* no merge needed on elements of different types than @nr */
- if (iter->type != nr->type) {
+ if (iter->type != nr_type) {
list_move_tail(&iter->list, &stack);
continue;
}
--
2.20.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-25 10:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-25 10:35 [PATCH] iommu: fix KASAN use-after-free in iommu_insert_resv_region Eric Auger
2019-11-25 10:35 ` Eric Auger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.