]> git.itanic.dy.fi Git - linux-stable/commit
tee: shm: fix use-after-free via temporarily dropped reference
authorJann Horn <jannh@google.com>
Wed, 4 Apr 2018 19:03:21 +0000 (21:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 May 2018 16:56:21 +0000 (18:56 +0200)
commit3c079e40eea50b3f2168648922e80bc942c81cce
tree5a8cb779c1d1cc79c42aaff2567ebdf2f63cdee9
parent7f8538e799e975e5f6028167418a208891d1c5f1
tee: shm: fix use-after-free via temporarily dropped reference

commit bb765d1c331f62b59049d35607ed2e365802bef9 upstream.

Bump the file's refcount before moving the reference into the fd table,
not afterwards. The old code could drop the file's refcount to zero for a
short moment before calling get_file() via get_dma_buf().

This code can only be triggered on ARM systems that use Linaro's OP-TEE.

Fixes: 967c9cca2cc5 ("tee: generic TEE subsystem")
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tee/tee_shm.c