]> git.baikalelectronics.ru Git - kernel.git/commit
tee: shm: don't put_page on null shm->pages
authorColin Ian King <colin.king@canonical.com>
Fri, 22 Dec 2017 17:51:50 +0000 (17:51 +0000)
committerJens Wiklander <jens.wiklander@linaro.org>
Thu, 28 Dec 2017 21:20:10 +0000 (22:20 +0100)
commit50008cdc95451f5938f2b261713ddf23808c7aa2
tree7742a74048136041c64b869d4ea0aae6650a51b8
parent34e6d6093e800f1df495d067f336891f5162a25a
tee: shm: don't put_page on null shm->pages

In the case that shm->pages fails to allocate, the current exit
error path will try to put_page on a null shm->pages and cause
a null pointer dereference when accessing shm->pages[n]. Fix this
by only performing the put_page and kfree on shm->pages if it
is not null.

Detected by CoverityScan, CID#1463283 ("Dereference after null check")

Fixes: cf1c5c9991e6 ("tee: add register user memory")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/tee_shm.c