diff options
author | Volodymyr Babchuk <vlad.babchuk@gmail.com> | 2018-05-18 19:58:34 +0300 |
---|---|---|
committer | Jérôme Forissier <jerome.forissier@linaro.org> | 2018-05-23 17:32:25 +0200 |
commit | 45e286b0329810fc1951c5cdbcfd3728c7d162c9 (patch) | |
tree | aaf8bfb96cfd39d9be794840c33749d1419a02a3 /core/tee | |
parent | a97bc4a084f1292c3a2cfd0c4593183b2f873e67 (diff) |
tee_ree_fs: avoid race condition between fh usage/closing
It is possible that one core will call ree_fs_close_primitive()
while another is calling ree_fs_read_primitive(). This patch
prevents this by putting ree_fs_close_primitive under mutex.
Signed-off-by: Volodymyr Babchuk <vlad.babchuk@gmail.com>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core/tee')
-rw-r--r-- | core/tee/tee_ree_fs.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/tee/tee_ree_fs.c b/core/tee/tee_ree_fs.c index 46578b55..0ad686c3 100644 --- a/core/tee/tee_ree_fs.c +++ b/core/tee/tee_ree_fs.c @@ -685,10 +685,10 @@ static void ree_fs_close(struct tee_file_handle **fh) if (*fh) { mutex_lock(&ree_fs_mutex); put_dirh_primitive(false); - mutex_unlock(&ree_fs_mutex); - ree_fs_close_primitive(*fh); *fh = NULL; + mutex_unlock(&ree_fs_mutex); + } } |