summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/video/tegra/Kconfig11
-rw-r--r--drivers/video/tegra/nvmap/nvmap_ioctl.c10
2 files changed, 21 insertions, 0 deletions
diff --git a/drivers/video/tegra/Kconfig b/drivers/video/tegra/Kconfig
index 9968738777fd..c9e5f21a69c2 100644
--- a/drivers/video/tegra/Kconfig
+++ b/drivers/video/tegra/Kconfig
@@ -77,5 +77,16 @@ config NVMAP_CARVEOUT_KILLER
processes. This will kill the largest consumers of lowest priority
first.
+config NVMAP_SEARCH_GLOBAL_HANDLES
+ bool "Check global handle list when generating memory IDs"
+ depends on TEGRA_NVMAP
+ default n
+ help
+ Say Y here to allow the system to search through memory handles not
+ owned by the caller when generating a memory ID. This shouldn't be
+ necessary for well-written applications, but is provided for
+ compatibility with legacy applications.
+ If unsure, say N.
+
endif
diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c
index b943065a44c0..0c772f81ffa8 100644
--- a/drivers/video/tegra/nvmap/nvmap_ioctl.c
+++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c
@@ -143,6 +143,16 @@ int nvmap_ioctl_getid(struct file *filp, void __user *arg)
h = nvmap_get_handle_id(client, op.handle);
+#ifdef CONFIG_NVMAP_SEARCH_GLOBAL_HANDLES
+ /*
+ * Check for device-wide global handles. This may be needed in broken
+ * memory sharing scenarios when handles are passed from client to
+ * client instead of the memory IDs.
+ */
+ if (!h)
+ h = nvmap_validate_get(client, op.handle);
+#endif
+
if (!h)
return -EPERM;