We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ab4aba commit 7b21b69Copy full SHA for 7b21b69
drivers/infiniband/core/uverbs_main.c
@@ -967,11 +967,19 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile)
967
968
/* Get an arbitrary mm pointer that hasn't been cleaned yet */
969
mutex_lock(&ufile->umap_lock);
970
- if (!list_empty(&ufile->umaps)) {
971
- mm = list_first_entry(&ufile->umaps,
972
- struct rdma_umap_priv, list)
973
- ->vma->vm_mm;
974
- mmget(mm);
+ while (!list_empty(&ufile->umaps)) {
+ int ret;
+
+ priv = list_first_entry(&ufile->umaps,
+ struct rdma_umap_priv, list);
975
+ mm = priv->vma->vm_mm;
976
+ ret = mmget_not_zero(mm);
977
+ if (!ret) {
978
+ list_del_init(&priv->list);
979
+ mm = NULL;
980
+ continue;
981
+ }
982
+ break;
983
}
984
mutex_unlock(&ufile->umap_lock);
985
if (!mm)
0 commit comments