From: jens.wiklander@linaro.org (Jens Wiklander)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] tee: optee: avoid possible double list_del()
Date: Wed, 21 Nov 2018 07:48:00 +0100 [thread overview]
Message-ID: <20181121064759.GA12645@jax.urgonet> (raw)
In-Reply-To: <20181121030143.31180-1-zhizhouzhang@asrmicro.com>
Hi Zhizhou,
On Wed, Nov 21, 2018 at 11:01:43AM +0800, Zhizhou Zhang wrote:
> 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>
> ---
> drivers/tee/optee/supp.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
Looks good. I'm picking this up.
Thanks,
Jens
next prev parent reply other threads:[~2018-11-21 6:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 3:01 [PATCH] tee: optee: avoid possible double list_del() Zhizhou Zhang
2018-11-21 6:48 ` Jens Wiklander [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-11-19 6:41 Zhizhou Zhang
2018-11-19 10:08 ` Jens Wiklander
2018-11-19 10:32 ` Zhang Zhizhou(张治洲)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121064759.GA12645@jax.urgonet \
--to=jens.wiklander@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox