linux-stable/drivers/tee/optee
Zhizhou Zhang 39d4c1c0dd tee: optee: avoid possible double list_del()
[ Upstream commit b2d102bd01 ]

This bug occurs when:

- a new request arrives, one thread(let's call it A) is pending in
  optee_supp_req() with req->busy is initial value false.

- tee-supplicant is killed, then optee_supp_release() is called, this
  function calls list_del(&req->link), and set supp->ctx to NULL. And
  it also wake up process A.

- process A continues, it firstly checks supp->ctx which is NULL,
  then checks req->busy which is false, at last run list_del(&req->link).
  This triggers double list_del() and results kernel panic.

For solve this problem, we rename req->busy to req->in_queue, and
associate it with state of whether req is linked to supp->reqs. So we
can just only check req->in_queue to make decision calling list_del()
or not.

Signed-off-by: Zhizhou Zhang <zhizhouzhang@asrmicro.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12 19:47:08 +01:00
..
call.c This pull request updates the previous tee-drv-dynamic-shm-for-v4.16 pull 2018-01-11 18:05:06 -08:00
core.c tee: optee: making OPTEE_SHM_NUM_PRIV_PAGES configurable via Kconfig 2018-06-20 11:20:36 +02:00
Kconfig tee: optee: making OPTEE_SHM_NUM_PRIV_PAGES configurable via Kconfig 2018-06-20 11:20:36 +02:00
Makefile tee: optee: add optee-specific shared pool implementation 2017-12-15 13:36:17 +01:00
optee_msg.h tee: optee: Update protocol definitions 2017-12-15 13:32:31 +01:00
optee_private.h This pull request updates the previous tee-drv-dynamic-shm-for-v4.16 pull 2018-01-11 18:05:06 -08:00
optee_smc.h tee: optee: GET_OS_REVISION: document a2 as a build identifier 2018-03-06 11:03:55 +01:00
rpc.c tee: replace getnstimeofday64() with ktime_get_real_ts64() 2018-06-19 16:37:14 +02:00
shm_pool.c tee: optee: add optee-specific shared pool implementation 2017-12-15 13:36:17 +01:00
shm_pool.h tee: optee: add optee-specific shared pool implementation 2017-12-15 13:36:17 +01:00
supp.c tee: optee: avoid possible double list_del() 2019-02-12 19:47:08 +01:00