teedev_ctx_get(9)
β¨ teedev_ctx_get(9) β¨
okay bestie, welcome to the Kernel API Manual β yes we're reading kernel docs together, this is our hangout now π
this one's teedev_ctx_get(9) and it's literally a one-line function that does One Job and honestly? icon behavior.
πΈ NAME πΈ
teedev_ctx_get β bump up the reference count on a context, that's it, that's the whole gig π
π¦ SYNOPSIS π¦
void teedev_ctx_get (struct tee_context *ctx );
π ARGUMENTS π
ctxβ a pointer to the context. like, the context itself, not a copy, not a vibe, the actual pointer π«Ά
π₯ DESCRIPTION π₯
So what's actually happening here: this function increases the refcount of the context. And that context is tied to resources that get shared by the same tee_device β so it's all one big friend group, yk? π
Now here's the part that matters, bestie, pay attention: during the unregistration process, the context may stay valid even after tee_device_unregister has already returned. Yeah. It outlives it. main character energy honestly π
So what are you supposed to do? You gotta make sure the context's refcount is properly decreased before you call tee_device_put β typically that happens inside the context's release function, which is exactly where it belongs π
OR, alternative route: users can call tee_device_get and teedev_ctx_get together, then release them simultaneously. (peep shm_alloc_helper for the example, iykyk β)
π SEE ALSO π
the whole extended universe, no cap β kernel file ./include/linux/tee_core.h plus:
struct tee_device(9)struct tee_driver_ops(9)struct tee_desc(9)struct tee_protmem_pool(9)struct tee_protmem_pool_ops(9)tee_device_alloc(9)tee_device_register(9)tee_device_unregister(9)tee_device_get(9)tee_device_put(9)tee_device_set_dev_groups(9)tee_session_calc_client_uuid(9)struct tee_shm_pool(9)struct tee_shm_pool_ops(9)tee_shm_pool_free(9)tee_protmem_static_pool_alloc(9)tee_get_drvdata(9)tee_shm_alloc_priv_buf(9)tee_shm_is_dynamic(9)tee_shm_put(9)tee_shm_get_id(9)tee_shm_get_from_id(9)teedev_open(9)teedev_close_context(9)teedev_ctx_put(9)
β οΈ real talk: forget to drop that refcount before tee_device_put and you're gonna have a bad time. this is not a drill, bestie π
and that's the whole page!! sourced from ./include/linux, dated October 2026, filed under teedev_ctx_get(9) β mwah, go refcount responsibly π§π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms