]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
tee: fix put order in teedev_close_context()
authorJens Wiklander <jens.wiklander@linaro.org>
Tue, 15 Jun 2021 20:23:50 +0000 (22:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 08:04:17 +0000 (09:04 +0100)
commit564a7ca7b4b657d5cbe41c9240fef44faebb6266
tree5a194a20b85887c3c45b33097cbdbdc97799c36e
parent4a1491432394b22e585a185ffca49086e4046aae
tee: fix put order in teedev_close_context()

[ Upstream commit f18397ab3ae23e8e43bba9986e66af6d4497f2ad ]

Prior to this patch was teedev_close_context() calling tee_device_put()
before teedev_ctx_put() leading to teedev_ctx_release() accessing
ctx->teedev just after the reference counter was decreased on the
teedev. Fix this by calling teedev_ctx_put() before tee_device_put().

Fixes: 217e0250cccb ("tee: use reference counting for tee_context")
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tee/tee_core.c