On Fri, Feb 18, 2022 at 05:39:10PM +0100, Jens Wiklander wrote:
commit aceeafefff736057e8f93f19bbfbef26abd94604 upstream
Adds a driver private tee_context to struct optee.
The new driver internal tee_context is used when allocating driver private shared memory. This decouples the shared memory object from its original tee_context. This is needed when the life time of such a memory allocation outlives the client tee_context.
This fixes a problem where the tee_context allocated on behalf of a process outlives the process because some longer lived driver internal shared memory has been allocated using that tee_context.
Fixes: 217e0250cccb ("tee: use reference counting for tee_context") Reported-by: Lars Persson larper@axis.com Cc: stable@vger.kernel.org # 1e2c3ef0496e tee: export teedev_open() and teedev_close_context() Cc: stable@vger.kernel.org Reviewed-by: Sumit Garg sumit.garg@linaro.org [JW: backport to 5.4-stable + update commit message] Signed-off-by: Jens Wiklander jens.wiklander@linaro.org
Hi,
Please note that this patch depends on 1e2c3ef0496e ("tee: export teedev_open() and teedev_close_context()") which needs be cherry-picked before this patch is applied.
This differs from the previous backports (5.16, 5.15, 5.10) in the way that f25889f93184 ("optee: fix tee out of memory failure seen during kexec reboot") isn't in this branch. So we can't claim to fix that problem, but this patch still makes sense since the lifetime problem can manifest itself in other ways too.
Now queued up, thanks.
greg k-h