Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da0b42d1 authored by Jens Wiklander's avatar Jens Wiklander Committed by Greg Kroah-Hartman
Browse files

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: 217e0250 ("tee: use reference counting for tee_context")
Reviewed-by: default avatarSumit Garg <sumit.garg@linaro.org>
Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 24161b9c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -84,8 +84,10 @@ void teedev_ctx_put(struct tee_context *ctx)

static void teedev_close_context(struct tee_context *ctx)
{
	tee_device_put(ctx->teedev);
	struct tee_device *teedev = ctx->teedev;

	teedev_ctx_put(ctx);
	tee_device_put(teedev);
}

static int tee_open(struct inode *inode, struct file *filp)