diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c index 499fccba3d74b..cfb73d4b9ac3f 100644 --- a/drivers/tee/tee_shm.c +++ b/drivers/tee/tee_shm.c @@ -431,6 +431,17 @@ struct tee_shm *tee_shm_get_from_id(struct tee_context *ctx, int id) } EXPORT_SYMBOL_GPL(tee_shm_get_from_id); +/** + * tee_shm_get() - Increase reference count on a shared memory handle + * @shm: Shared memory handle + */ +void tee_shm_get(struct tee_shm *shm) +{ + if (shm->flags & TEE_SHM_DMA_BUF) + get_dma_buf(shm->dmabuf); +} +EXPORT_SYMBOL_GPL(tee_shm_get); + /** * tee_shm_put() - Decrease reference count on a shared memory handle * @shm: Shared memory handle diff --git a/include/linux/tee_drv.h b/include/linux/tee_drv.h index feda1dc7f98ee..cb7e716ae79b9 100644 --- a/include/linux/tee_drv.h +++ b/include/linux/tee_drv.h @@ -363,6 +363,12 @@ static inline bool tee_shm_is_registered(struct tee_shm *shm) */ void tee_shm_free(struct tee_shm *shm); +/** + * tee_shm_get() - Increase reference count on a shared memory handle + * @shm: Shared memory handle + */ +void tee_shm_get(struct tee_shm *shm); + /** * tee_shm_put() - Decrease reference count on a shared memory handle * @shm: Shared memory handle