aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/host1x.h
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-06-10 04:25:00 -0400
committerThierry Reding <treding@nvidia.com>2014-08-04 04:07:36 -0400
commit961e3beae3b29ae9463631415342244cdaf1cd47 (patch)
tree3b961e00f8cde9f11e88cdcab604d927d7757446 /include/linux/host1x.h
parentbd4f236024a8027b2d5ee9de1f823fbf07c39cef (diff)
drm/tegra: Make job submission 64-bit safe
Job submission currently relies on the fact that struct drm_tegra_reloc and struct host1x_reloc are the same size and uses a simple call to the copy_from_user() function to copy them to kernel space. This causes the handle to be stored in the buffer object field, which then needs a cast to a 32 bit integer to resolve it to a proper buffer object pointer and store it back in the buffer object field. On 64-bit architectures that will no longer work, since pointers are 64 bits wide whereas handles will remain 32 bits. This causes the sizes of both structures to because different and copying will no longer work. Fix this by adding a new function, host1x_reloc_get_user(), that copies the structures field by field. While at it, use substructures for the command and target buffers in struct host1x_reloc for better readability. Also use unsized types to make it more obvious that this isn't part of userspace ABI. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'include/linux/host1x.h')
-rw-r--r--include/linux/host1x.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index d2b52999e771..bb9840fd1e18 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -164,12 +164,15 @@ int host1x_job_submit(struct host1x_job *job);
164 */ 164 */
165 165
166struct host1x_reloc { 166struct host1x_reloc {
167 struct host1x_bo *cmdbuf; 167 struct {
168 u32 cmdbuf_offset; 168 struct host1x_bo *bo;
169 struct host1x_bo *target; 169 unsigned long offset;
170 u32 target_offset; 170 } cmdbuf;
171 u32 shift; 171 struct {
172 u32 pad; 172 struct host1x_bo *bo;
173 unsigned long offset;
174 } target;
175 unsigned long shift;
173}; 176};
174 177
175struct host1x_job { 178struct host1x_job {