]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/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)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 14 Aug 2018 10:27:18 +0000 (12:27 +0200)
commit3fac101587595b0c8929c64990f2fbe36705986e
treefcb47760916ecbe2c97b62c0320fb18827462125
parentca881d20ff7ea4632eb7054277aad85da4cc0121
tee: shm: fix use-after-free via temporarily dropped reference

BugLink: http://bugs.launchpad.net/bugs/1782846
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/tee/tee_shm.c