All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] mm/hmm/test: fix missing unlock on error in dmirror_migrate_finalize_and_map()
@ 2020-05-09  3:02 ` Wei Yongjun
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Yongjun @ 2020-05-09  2:58 UTC (permalink / raw)
  To: jglisse, Ralph Campbell
  Cc: Wei Yongjun, linux-mm, linux-kernel, kernel-janitors, Hulk Robot

Add the missing unlock before return from function
dmirror_migrate_finalize_and_map() in the error
handling case.

Fixes: 5d5e54be8a1e ("mm/hmm/test: add selftest driver for HMM")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 lib/test_hmm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 00bca6116f93..30462193c4ff 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -647,8 +647,10 @@ static int dmirror_migrate_finalize_and_map(struct migrate_vma *args,
 		if (*dst & MIGRATE_PFN_WRITE)
 			entry = xa_tag_pointer(entry, DPT_XA_TAG_WRITE);
 		entry = xa_store(&dmirror->pt, pfn, entry, GFP_ATOMIC);
-		if (xa_is_err(entry))
+		if (xa_is_err(entry)) {
+			mutex_unlock(&dmirror->mutex);
 			return xa_err(entry);
+		}
 	}
 
 	mutex_unlock(&dmirror->mutex);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-12 19:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09  2:58 [PATCH -next] mm/hmm/test: fix missing unlock on error in dmirror_migrate_finalize_and_map() Wei Yongjun
2020-05-09  3:02 ` Wei Yongjun
2020-05-11 17:22 ` Ralph Campbell
2020-05-11 17:22   ` Ralph Campbell
2020-05-12 19:59 ` Jason Gunthorpe
2020-05-12 19:59   ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.