]> git.proxmox.com Git - mirror_ubuntu-focal-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)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 7 Mar 2022 15:34:33 +0000 (16:34 +0100)
commit8da02c9bce511b5a98d45abce3024eab0a41b8b4
treef899823f4e8eac65b690903209de7deba596104d
parent4c67daed71cf470e102a851ab797ce234858b5a4
tee: optee: Fix incorrect page free bug

BugLink: https://bugs.launchpad.net/bugs/1958557
commit 18549bf4b21c739a9def39f27dcac53e27286ab5 upstream.

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: ec185dd3ab25 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/tee/optee/shm_pool.c