Skip to content

Commit 917b3c7

Browse files
committed
Merge tag 'iommu-fix-v6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu fix from Joerg Roedel: - Fix potential memory leak in AMD IOMMU domain allocation path * tag 'iommu-fix-v6.4-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/amd: Fix possible memory leak of 'domain'
2 parents 61dabac + 5b00369 commit 917b3c7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2078,10 +2078,6 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
20782078
int mode = DEFAULT_PGTABLE_LEVEL;
20792079
int ret;
20802080

2081-
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
2082-
if (!domain)
2083-
return NULL;
2084-
20852081
/*
20862082
* Force IOMMU v1 page table when iommu=pt and
20872083
* when allocating domain for pass-through devices.
@@ -2097,6 +2093,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
20972093
return NULL;
20982094
}
20992095

2096+
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
2097+
if (!domain)
2098+
return NULL;
2099+
21002100
switch (pgtable) {
21012101
case AMD_IOMMU_V1:
21022102
ret = protection_domain_init_v1(domain, mode);

0 commit comments

Comments
 (0)