Commit 187229c2 authored by Jason Gunthorpe's avatar Jason Gunthorpe

mm/hmm: Remove racy protection against double-unregistration

No other register/unregister kernel API attempts to provide this kind of
protection as it is inherently racy, so just drop it.

Callers should provide their own protection, and it appears nouveau
already does.
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Reviewed-by: default avatarJérôme Glisse <jglisse@redhat.com>
Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
Reviewed-by: default avatarRalph Campbell <rcampbell@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Tested-by: default avatarPhilip Yang <Philip.Yang@amd.com>
parent 8a1a0cd0
......@@ -276,17 +276,11 @@ EXPORT_SYMBOL(hmm_mirror_register);
*/
void hmm_mirror_unregister(struct hmm_mirror *mirror)
{
struct hmm *hmm = READ_ONCE(mirror->hmm);
if (hmm == NULL)
return;
struct hmm *hmm = mirror->hmm;
down_write(&hmm->mirrors_sem);
list_del_init(&mirror->list);
/* To protect us against double unregister ... */
mirror->hmm = NULL;
up_write(&hmm->mirrors_sem);
hmm_put(hmm);
}
EXPORT_SYMBOL(hmm_mirror_unregister);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment