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: 033ddf12 ("tee: add register user memory")
Signed-off-by: NColin Ian King <colin.king@canonical.com>
Signed-off-by: NJens Wiklander <jens.wiklander@linaro.org>
Showing
想要评论请 注册 或 登录