]> git.baikalelectronics.ru Git - kernel.git/commit
tee: optee: Fix incorrect page free bug
authorSumit Garg <sumit.garg@linaro.org>
Thu, 16 Dec 2021 05:47:25 +0000 (11:17 +0530)
committerJens Wiklander <jens.wiklander@linaro.org>
Thu, 16 Dec 2021 14:32:37 +0000 (15:32 +0100)
commitc3c7c58fd31c747cdc843dcef89c28f2b3f73665
tree8ba72382308c789e01ee6941f453a34fa56108f2
parente2fa49b7099ec15cc17a1a5bb1fc5de380fcab8c
tee: optee: Fix incorrect page free bug

Pointer to the allocated pages (struct page *page) has already
progressed towards the end of allocation. It is incorrect to perform
__free_pages(page, order) using this pointer as we would free any
arbitrary pages. Fix this by stop modifying the page pointer.

Fixes: b1d3fc574a90 ("optee: Fix memory leak when failing to register shm pages")
Cc: stable@vger.kernel.org
Reported-by: Patrik Lantz <patrik.lantz@axis.com>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Reviewed-by: Tyler Hicks <tyhicks@linux.microsoft.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/optee/core.c