gpu: ipu-v3: image-convert: Prevent race between run and unprepare
authorSteve Longerbeam <slongerbeam@gmail.com>
Wed, 19 Sep 2018 23:07:18 +0000 (16:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:44:51 +0000 (19:44 +0100)
commiteef25b07bad1ed9bace5790c8f7a1e568778796a
treeb5bffc9dd4c0a2261be1f35b5b4e24a2b44e4004
parent8c25e7a4ed6fa51b597572f464adf415bf88802c
gpu: ipu-v3: image-convert: Prevent race between run and unprepare

[ Upstream commit 819bec35c8c9706185498c9222bd244e0781ad35 ]

Prevent possible race by parallel threads between ipu_image_convert_run()
and ipu_image_convert_unprepare(). This involves setting ctx->aborting
to true unconditionally so that no new job runs can be queued during
unprepare, and holding the ctx->aborting flag until the context is freed.

Note that the "normal" ipu_image_convert_abort() case (e.g. not during
context unprepare) should clear the ctx->aborting flag after aborting
any active run and clearing the context's pending queue. This is because
it should be possible to continue to use the conversion context and queue
more runs after an abort.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/ipu-v3/ipu-image-convert.c