diff options
author | Laura Abbott <lauraa@codeaurora.org> | 2014-02-04 19:08:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-07 12:03:16 -0500 |
commit | 8666a87611fbd8597111c96e93a2f075664ee392 (patch) | |
tree | 1cce154be6b33791d5c9d39dc59b4279230b8385 /drivers/staging | |
parent | c9e8440eca61298ecccbb27f53036124a7a3c6c8 (diff) |
staging: ion: Fix ION_IOC_FREE compat ioctl
The compat ioctl for ION_IOC_FREE currently passes allocation data
instead of the free data. Correct this.
Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[jstultz: Folded in a small build fix]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/android/ion/compat_ion.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/staging/android/ion/compat_ion.c b/drivers/staging/android/ion/compat_ion.c index af6cd370b30f..ee3a7380e53b 100644 --- a/drivers/staging/android/ion/compat_ion.c +++ b/drivers/staging/android/ion/compat_ion.c | |||
@@ -35,9 +35,14 @@ struct compat_ion_custom_data { | |||
35 | compat_ulong_t arg; | 35 | compat_ulong_t arg; |
36 | }; | 36 | }; |
37 | 37 | ||
38 | struct compat_ion_handle_data { | ||
39 | compat_int_t handle; | ||
40 | }; | ||
41 | |||
38 | #define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ | 42 | #define COMPAT_ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ |
39 | struct compat_ion_allocation_data) | 43 | struct compat_ion_allocation_data) |
40 | #define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) | 44 | #define COMPAT_ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, \ |
45 | struct compat_ion_handle_data) | ||
41 | #define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \ | 46 | #define COMPAT_ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, \ |
42 | struct compat_ion_custom_data) | 47 | struct compat_ion_custom_data) |
43 | 48 | ||
@@ -64,6 +69,19 @@ static int compat_get_ion_allocation_data( | |||
64 | return err; | 69 | return err; |
65 | } | 70 | } |
66 | 71 | ||
72 | static int compat_get_ion_handle_data( | ||
73 | struct compat_ion_handle_data __user *data32, | ||
74 | struct ion_handle_data __user *data) | ||
75 | { | ||
76 | compat_int_t i; | ||
77 | int err; | ||
78 | |||
79 | err = get_user(i, &data32->handle); | ||
80 | err |= put_user(i, &data->handle); | ||
81 | |||
82 | return err; | ||
83 | } | ||
84 | |||
67 | static int compat_put_ion_allocation_data( | 85 | static int compat_put_ion_allocation_data( |
68 | struct compat_ion_allocation_data __user *data32, | 86 | struct compat_ion_allocation_data __user *data32, |
69 | struct ion_allocation_data __user *data) | 87 | struct ion_allocation_data __user *data) |
@@ -132,8 +150,8 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
132 | } | 150 | } |
133 | case COMPAT_ION_IOC_FREE: | 151 | case COMPAT_ION_IOC_FREE: |
134 | { | 152 | { |
135 | struct compat_ion_allocation_data __user *data32; | 153 | struct compat_ion_handle_data __user *data32; |
136 | struct ion_allocation_data __user *data; | 154 | struct ion_handle_data __user *data; |
137 | int err; | 155 | int err; |
138 | 156 | ||
139 | data32 = compat_ptr(arg); | 157 | data32 = compat_ptr(arg); |
@@ -141,7 +159,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
141 | if (data == NULL) | 159 | if (data == NULL) |
142 | return -EFAULT; | 160 | return -EFAULT; |
143 | 161 | ||
144 | err = compat_get_ion_allocation_data(data32, data); | 162 | err = compat_get_ion_handle_data(data32, data); |
145 | if (err) | 163 | if (err) |
146 | return err; | 164 | return err; |
147 | 165 | ||