path: root/drivers
diff options
authorAndrey Konovalov <>2019-09-25 16:48:58 -0700
committerLinus Torvalds <>2019-09-25 17:51:41 -0700
commit78063a9dd9637c0450cf6eacc03f42eb1295917f (patch)
treef5c00fb926b7bb88bc8639e05e0fca1f4e365524 /drivers
parente275faf367e3a3b9db06a71924b199f429d3d508 (diff)
tee/shm: untag user pointers in tee_shm_register
This patch is a part of a series that extends kernel ABI to allow to pass tagged user pointers (with the top byte set to something else other than 0x00) as syscall arguments. tee_shm_register()->optee_shm_unregister()->check_mem_type() uses provided user pointers for vma lookups (via __check_mem_type()), which can only by done with untagged pointers. Untag user pointers in this function. Link: Signed-off-by: Andrey Konovalov <> Reviewed-by: Kees Cook <> Acked-by: Jens Wiklander <> Cc: Al Viro <> Cc: Catalin Marinas <> Cc: Dave Hansen <> Cc: Eric Auger <> Cc: Felix Kuehling <> Cc: Khalid Aziz <> Cc: Mauro Carvalho Chehab <> Cc: Mike Rapoport <> Cc: Vincenzo Frascino <> Cc: Will Deacon <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'drivers')
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index 2da026fd12c9..09ddcd06c715 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -254,6 +254,7 @@ struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
shm->teedev = teedev;
shm->ctx = ctx;
shm->id = -1;
+ addr = untagged_addr(addr);
start = rounddown(addr, PAGE_SIZE);
shm->offset = addr - start;
shm->size = length;