A single bugfix for the PASID management code, which freed the PASID too

early. The PASID needs to be tied to the mm lifetime, not to the address
 space lifetime.
 -----BEGIN PGP SIGNATURE-----
 
 iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAmJ3r7sTHHRnbHhAbGlu
 dXRyb25peC5kZQAKCRCmGPVMDXSYoQPsD/41fEE71j8VIElRbwQYnhmTa8Gm+F3X
 J5+88ksOA9ho8HwEZsI56lIqCFchDolrk4BgJD8PYelotClHMjexPQkZvLB84hIM
 KDvXsvPtaqGa/xYbnoSZM4M0litQBONVgSkW6a5qzOfxUrQbTsvqsDO0tUA5rCGm
 FCNd5ACTwLDo3gp0TLKDXtkrTC8r/JBTG7TyOkQtezFpUFQNAV2TeEgzopkJNhEu
 7Y1py5xkq08J4cRrK/k62DgPTdAdHQv97TB/SWYFLL3jjq4p8kJpUt1bi26BivIc
 xIRudSmWKSz07KoL0/omE/nxpIzRMQSRmIl9FKHEsOa0hRoG8GYyOmpU84x3vHUn
 XZg0OedN1555RNY5DnFoIBuTQTukJLGUO1rfc/9I4PaGtyomISuAtEDNR9vUWqTF
 k1/2kx6FdxHCn8AXgx3Xp8qxi92FoyGFFfiib8nXu+ns0YhVTO2qKKoKK+WRhKjK
 iOp1z/ZOZDiHOSCZNFOJ0wW7Hq6DD17WpJXPiPJ7XmCTZgaq9FecXwLhoXW6H251
 /TexTYJt+z/MlS86godsPEh+mBDga8qh7TaMT8loswES26Anghh9CZT9ws3psqKc
 ahQb6TJqbW3C5BKrUBMiDeE4iSF06ZQv/+l+iAFvmGDusx/t8QQ8i8oUFI2M7T11
 rlbINCN6/UaJsw==
 =CVeU
 -----END PGP SIGNATURE-----

Merge tag 'core-urgent-2022-05-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull PASID fix from Thomas Gleixner:
 "A single bugfix for the PASID management code, which freed the PASID
  too early. The PASID needs to be tied to the mm lifetime, not to the
  address space lifetime"

* tag 'core-urgent-2022-05-08' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  mm: Fix PASID use-after-free issue
This commit is contained in:
Linus Torvalds 2022-05-08 10:28:22 -07:00
commit 1f8c5dff00

View file

@ -792,6 +792,7 @@ void __mmdrop(struct mm_struct *mm)
mmu_notifier_subscriptions_destroy(mm);
check_mm(mm);
put_user_ns(mm->user_ns);
mm_pasid_drop(mm);
free_mm(mm);
}
EXPORT_SYMBOL_GPL(__mmdrop);
@ -1190,7 +1191,6 @@ static inline void __mmput(struct mm_struct *mm)
}
if (mm->binfmt)
module_put(mm->binfmt->module);
mm_pasid_drop(mm);
mmdrop(mm);
}