IOMMU fix for Linux v6.4-rc7:

- AMD IOMMU: Fix potential memory leak in domain allocation path
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEr9jSbILcajRFYWYyK/BELZcBGuMFAmSVmKYACgkQK/BELZcB
 GuOE2RAAjjIzyxinvvmnoepi5YnUW4rU7Ija9Gsh2OnK257JAOgUbzXfSJoEhNjn
 P3ePhtJeh8ZWLJYaefwFZQdhKpE5dqq20RK8p0aDHZgia6Lm9pS/qKsPE6wdpZua
 V0+N+zUDcGW9BshrWSXCVgY5yg5pJLdYhCp8KgRJS2YT/gScXG+3uYswd8aYCCDw
 6/TtW9VCMKhmXQLARJm8Ok22OYYHijETMh8Ap5WSafoZwQo8xg59Favg4yiNS5++
 U/m02DvKqvtIn0n8l5N2pz/mYK480kZillSOrts12a/vk27kH83jSwbW7fa3BVZo
 ozyuf4PY6bb08QMva77aepaAG2yKHavb2V5dPbEAAdmg7+a0UO1gNNi8YxZLZfc8
 1kLiEcZ1W+b1zFaOO/wslXsIurdsLmvanVBDoIrUYJsEVJeVy5BF6v+TBoJCBSMl
 yz6C7HuzwORzXZSJs+YqrSl+vwnMquQpUiekEmW9DuhewOMc7Q+OS1pz83B6p3j2
 oGZxc06dDCPoo2C3or5vhfgwhQfyzChifFbJAkqUPWJxIL68yF1XYbnHlpAXe8Ri
 y5LHZ4ILyLVhDKIdw/ZXY79WXtDRtEBvEiBxk1lqlY7yS4PusNGVk47Qbf3yGOGO
 m0+xm9kHFTTNuvPb/JC83BluwrLjmmxKyCeq2wUY8uJjid7rYMA=
 =/DJq
 -----END PGP SIGNATURE-----

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'
This commit is contained in:
Linus Torvalds 2023-06-23 15:56:44 -07:00
commit 917b3c7c0b

View file

@ -2078,10 +2078,6 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
int mode = DEFAULT_PGTABLE_LEVEL;
int ret;
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
if (!domain)
return NULL;
/*
* Force IOMMU v1 page table when iommu=pt and
* when allocating domain for pass-through devices.
@ -2097,6 +2093,10 @@ static struct protection_domain *protection_domain_alloc(unsigned int type)
return NULL;
}
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
if (!domain)
return NULL;
switch (pgtable) {
case AMD_IOMMU_V1:
ret = protection_domain_init_v1(domain, mode);