FAILED: patch "[PATCH] tee: optee: Fix incorrect page free bug" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 18549bf4b21c739a9def39f27dcac53e27286ab5 Mon Sep 17 00:00:00 2001
From: Sumit Garg <[email protected]>
Date: Thu, 16 Dec 2021 11:17:25 +0530
Subject: [PATCH] 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.
drivers/tee/optee/core.c +2 -4
@@ -48,10 +48,8 @@ int optee_pool_op_alloc_helper(struct tee_shm_pool_mgr *poolm, goto err; } -for (i =0 ; i < nr_pages; i++) { - pages[i] = page; - page++; - } +for (i =0 ; i < nr_pages; i++) + pages[i] = page + i; shm->flags |=TEE_SHM_REGISTER ; rc = shm_register(shm->ctx, shm, pages, nr_pages,