linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau/dmem: missing mutex_lock in error path
@ 2019-06-14  0:11 Ralph Campbell
  2019-06-14  0:24 ` Jason Gunthorpe
  2019-06-14  0:49 ` John Hubbard
  0 siblings, 2 replies; 5+ messages in thread
From: Ralph Campbell @ 2019-06-14  0:11 UTC (permalink / raw)
  To: Jerome Glisse, David Airlie, Ben Skeggs, Jason Gunthorpe
  Cc: nouveau, linux-mm, dri-devel, linux-kernel, Ralph Campbell

In nouveau_dmem_pages_alloc(), the drm->dmem->mutex is unlocked before
calling nouveau_dmem_chunk_alloc().
Reacquire the lock before continuing to the next page.

Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
---

I found this while testing Jason Gunthorpe's hmm tree but this is
independant of those changes. I guess it could go through
David Airlie's tree for nouveau or Jason's tree.

 drivers/gpu/drm/nouveau/nouveau_dmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c b/drivers/gpu/drm/nouveau/nouveau_dmem.c
index 27aa4e72abe9..00f7236af1b9 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
@@ -379,9 +379,10 @@ nouveau_dmem_pages_alloc(struct nouveau_drm *drm,
 			ret = nouveau_dmem_chunk_alloc(drm);
 			if (ret) {
 				if (c)
-					break;
+					return 0;
 				return ret;
 			}
+			mutex_lock(&drm->dmem->mutex);
 			continue;
 		}
 
-- 
2.20.1


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

end of thread, other threads:[~2019-06-14 17:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-14  0:11 [PATCH] drm/nouveau/dmem: missing mutex_lock in error path Ralph Campbell
2019-06-14  0:24 ` Jason Gunthorpe
2019-06-14  0:49 ` John Hubbard
2019-06-14 17:39   ` Ralph Campbell
2019-06-14 17:48     ` John Hubbard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox