kernel-fxtec-pro1x/drivers/tee
Zhizhou Zhang 39d4c1c0dd tee: optee: avoid possible double list_del()
[ Upstream commit b2d102bd0146d9eb1fa630ca0cd19a15ef2f74c8 ]

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
..
optee tee: optee: avoid possible double list_del() 2019-02-12 19:47:08 +01:00
Kconfig
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tee_core.c tee: check shm references are consistent in offset/size 2018-05-07 11:51:03 +02:00
tee_private.h tee: use reference counting for tee_context 2017-12-15 13:36:18 +01:00
tee_shm.c drm-misc-next for 4.19: 2018-06-22 12:58:08 +10:00
tee_shm_pool.c tee: flexible shared memory pool creation 2017-12-15 12:37:29 +01:00