From: Paolo Bonzini Date: Wed, 27 Nov 2019 16:38:57 +0000 Subject: Re: [PATCH] KVM: Add separate helper for putting borrowed reference to kvm Message-Id: MIME-Version: 1 Content-Type: multipart/mixed; boundary="3Lmtj4kXhlPoGtLw59Y3vMi7vMYbGdK96" List-Id: References: <20191021225842.23941-1-sean.j.christopherson@intel.com> <20191126171416.GA22233@linux.intel.com> <0009c6c1bb635098fa68cb6db6414634555039fe.camel@linux.ibm.com> In-Reply-To: <0009c6c1bb635098fa68cb6db6414634555039fe.camel@linux.ibm.com> To: Leonardo Bras , Sean Christopherson Cc: Paul Mackerras , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3Lmtj4kXhlPoGtLw59Y3vMi7vMYbGdK96 Content-Type: multipart/mixed; boundary="WkLoxHW9POPVer90XR7qa1FrtQmMJhTiI" --WkLoxHW9POPVer90XR7qa1FrtQmMJhTiI Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 26/11/19 18:53, Leonardo Bras wrote: >=20 > I agree an use-after-free more problem than a memory leak, but I think > that there is a way to solve this without leaking the memory also. >=20 > One option would be reordering the kvm_put_kvm(), like in this patch: > https://lkml.org/lkml/2019/11/26/517 It's a tradeoff between "fix one bug" and "mitigate all bugs of that class", both are good things to do. Reordering the kvm_put_kvm() fixes the bug. kvm_put_kvm_no_destroy() makes all bugs of that kind less severe, but it doesn't try to fix them. Paolo --WkLoxHW9POPVer90XR7qa1FrtQmMJhTiI-- --3Lmtj4kXhlPoGtLw59Y3vMi7vMYbGdK96 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAl3epqQACgkQv/vSX3jH roNLfwf9GmuvcuS13OxAQEUrvNcZKejSTVEMNHatSyAF9Od9GOJM9a9Uwk1vLAWd My7k3ZReRw9q4jOHtQp8AmPjrD6DYIsc2vj/dhbqTqkdD/z5bPBo4fJQpfSJilil 8uU801MQwZQ5RjgIXw8tn5biazTH6fpgJzvqaMUCHLziNF+Cof7vkXj+PTxtnmD4 d0YUvgUYLpPvA3tuVL0u+o74kzmZ8a8E9p/50Bri/q2BwWHXfulPedtyD7EulR17 nxpE0iPmcuA7Dv5N9xlSRGl9s759Jpaivy9kSh4UWRMjRi98lLZY5cmSoYShLOa/ MOQNgu+/CvGw793PBYnLXxxOqva5Gg== =+f4g -----END PGP SIGNATURE----- --3Lmtj4kXhlPoGtLw59Y3vMi7vMYbGdK96--