drm/nouveau/pm: fix a potential race condition when creating an engine context
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 7 Jun 2015 20:40:12 +0000 (22:40 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Mon, 27 Jul 2015 08:56:09 +0000 (18:56 +1000)
commit305c1959ea60ddcae5142a20c50db849a40c2a35
treed2e6a8f531cef0ec9432e96e50eeef1041acde96
parent3693d544056b822f7f2454da5acb7eda9471b902
drm/nouveau/pm: fix a potential race condition when creating an engine context

There is always the possiblity that the ppm->context pointer would get
partially updated and accidentally would equal ctx. This would allow two
contexts to co-exist, which is not acceptable. Moving the test to the
critical section takes care of this problem.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c