public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Laura Abbott <lauraa@codeaurora.org>,
	Greg KH <gregkh@linuxfoundation.org>,
	Colin Cross <ccross@android.com>,
	Android Kernel Team <kernel-team@android.com>,
	John Stultz <john.stultz@linaro.org>
Subject: [PATCH 14/16] staging: ion: Fix ION_IOC_FREE compat ioctl
Date: Mon,  3 Feb 2014 10:16:26 -0800	[thread overview]
Message-ID: <1391451388-23906-15-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1391451388-23906-1-git-send-email-john.stultz@linaro.org>

From: Laura Abbott <lauraa@codeaurora.org>

The compat ioctl for ION_IOC_FREE currently passes allocation data
instead of the free data. Correct this.

Cc: Greg KH <gregkh@linuxfoundation.org>
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>
---
 drivers/staging/android/ion/compat_ion.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/ion/compat_ion.c b/drivers/staging/android/ion/compat_ion.c
index af6cd37..ee3a738 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 {
 	compat_ulong_t arg;
 };
 
+struct compat_ion_handle_data {
+	compat_int_t handle;
+};
+
 #define COMPAT_ION_IOC_ALLOC	_IOWR(ION_IOC_MAGIC, 0, \
 				      struct compat_ion_allocation_data)
-#define COMPAT_ION_IOC_FREE	_IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
+#define COMPAT_ION_IOC_FREE	_IOWR(ION_IOC_MAGIC, 1, \
+				      struct compat_ion_handle_data)
 #define COMPAT_ION_IOC_CUSTOM	_IOWR(ION_IOC_MAGIC, 6, \
 				      struct compat_ion_custom_data)
 
@@ -64,6 +69,19 @@ static int compat_get_ion_allocation_data(
 	return err;
 }
 
+static int compat_get_ion_handle_data(
+			struct compat_ion_handle_data __user *data32,
+			struct ion_handle_data __user *data)
+{
+	compat_int_t i;
+	int err;
+
+	err = get_user(i, &data32->handle);
+	err |= put_user(i, &data->handle);
+
+	return err;
+}
+
 static int compat_put_ion_allocation_data(
 			struct compat_ion_allocation_data __user *data32,
 			struct ion_allocation_data __user *data)
@@ -132,8 +150,8 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 	}
 	case COMPAT_ION_IOC_FREE:
 	{
-		struct compat_ion_allocation_data __user *data32;
-		struct ion_allocation_data __user *data;
+		struct compat_ion_handle_data __user *data32;
+		struct ion_handle_data __user *data;
 		int err;
 
 		data32 = compat_ptr(arg);
@@ -141,7 +159,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		if (data == NULL)
 			return -EFAULT;
 
-		err = compat_get_ion_allocation_data(data32, data);
+		err = compat_get_ion_handle_data(data32, data);
 		if (err)
 			return err;
 
-- 
1.8.3.2


  parent reply	other threads:[~2014-02-03 18:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-03 18:16 [PATCH 00/16] [RFC] Staging updates from the Android tree John Stultz
2014-02-03 18:16 ` [PATCH 01/16] staging: android: Split uapi out of android_alarm.h John Stultz
2014-02-03 18:16 ` [PATCH 02/16] staging: android: Split uapi out of ashmem.h John Stultz
2014-02-03 18:16 ` [PATCH 03/16] staging: android: split uapi out of sync.h and sw_sync.h John Stultz
2014-02-03 18:16 ` [PATCH 04/16] staging: android: Split uapi out of binder.h John Stultz
2014-02-03 18:16 ` [PATCH 05/16] staging: sw_sync: Add stubs for kernels without CONFIG_SW_SYNC John Stultz
2014-02-03 18:16 ` [PATCH 06/16] staging: sync: Signal pt before sync_timeline object gets destroyed John Stultz
2014-02-03 18:16 ` [PATCH 07/16] staging: sync: Fix a race condition between release_obj and print_obj John Stultz
2014-02-03 18:16 ` [PATCH 08/16] staging: ashmem: Avoid deadlock between read and mmap calls John Stultz
2014-02-03 18:16 ` [PATCH 09/16] staging: ion: Create separate heap and client debugfs directories John Stultz
2014-02-03 18:16 ` [PATCH 10/16] staging: ion: Fix debugfs handling of multiple kernel clients John Stultz
2014-02-03 18:16 ` [PATCH 11/16] staging: ion: Store a copy of the client name on client creation John Stultz
2014-02-03 18:16 ` [PATCH 12/16] staging: ion: Make sure all clients are exposed in debugfs John Stultz
2014-02-03 18:16 ` [PATCH 13/16] staging: ion: Fix overflow and list bugs in system heap John Stultz
2014-02-03 18:16 ` John Stultz [this message]
2014-02-03 18:16 ` [PATCH 15/16] staging: ion: Move shrinker out of heaps John Stultz
2014-02-03 18:16 ` [PATCH 16/16] staging: ion: Add private buffer flag to skip page pooling on free John Stultz
2014-02-04  2:06 ` [PATCH 00/16] [RFC] Staging updates from the Android tree Greg KH
2014-02-04 20:14   ` John Stultz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1391451388-23906-15-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=ccross@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=lauraa@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox