aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2019-05-23 10:31:45 -0400
committerJason Gunthorpe <jgg@mellanox.com>2019-06-24 16:37:10 -0400
commit187229c2ddd12a5bb5cd6bb3fbef9ecbc6eead92 (patch)
treec0f05c9c81d53d3f6d79bc464ce35273f01a52a8
parent8a1a0cd0b770a0f40a49db923479879fa7135aae (diff)
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: Jason Gunthorpe <jgg@mellanox.com> Reviewed-by: Jérôme Glisse <jglisse@redhat.com> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Ralph Campbell <rcampbell@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Tested-by: Philip Yang <Philip.Yang@amd.com>
-rw-r--r--mm/hmm.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/mm/hmm.c b/mm/hmm.c
index 6f5dc6d568fe..2ef14b2b5505 100644
--- a/mm/hmm.c
+++ b/mm/hmm.c
@@ -276,17 +276,11 @@ EXPORT_SYMBOL(hmm_mirror_register);
276 */ 276 */
277void hmm_mirror_unregister(struct hmm_mirror *mirror) 277void hmm_mirror_unregister(struct hmm_mirror *mirror)
278{ 278{
279 struct hmm *hmm = READ_ONCE(mirror->hmm); 279 struct hmm *hmm = mirror->hmm;
280
281 if (hmm == NULL)
282 return;
283 280
284 down_write(&hmm->mirrors_sem); 281 down_write(&hmm->mirrors_sem);
285 list_del_init(&mirror->list); 282 list_del_init(&mirror->list);
286 /* To protect us against double unregister ... */
287 mirror->hmm = NULL;
288 up_write(&hmm->mirrors_sem); 283 up_write(&hmm->mirrors_sem);
289
290 hmm_put(hmm); 284 hmm_put(hmm);
291} 285}
292EXPORT_SYMBOL(hmm_mirror_unregister); 286EXPORT_SYMBOL(hmm_mirror_unregister);