From patchwork Mon Feb 3 18:16:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 24055 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f197.google.com (mail-yk0-f197.google.com [209.85.160.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8474E202B2 for ; Mon, 3 Feb 2014 18:16:54 +0000 (UTC) Received: by mail-yk0-f197.google.com with SMTP id 20sf45133207yks.0 for ; Mon, 03 Feb 2014 10:16:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=WNUe6kMv/JFXtMjWgK2uwjs5LZtVf8vPA8vz68Nyhmk=; b=dxC/6cC9rOvtPWaaCSL9qS7Vqxuom4gxu+pgGlrhkwBbBOnXZAjjByMJ1NpTrN+p9M fvpBmSWiNX+zBRELEqX0d2vLbnn4EpFA5yAGp8CYhgQnAtl3oz+hQZfyPI+h35f4gQuq g1NQDjBUKK3dIQdj951fif44BO1b1dEMVDAnIgmXNtXW94fy2TKmynOUcmkaevXMpcsX jQaExP7FB7k66V46QO4xmfpbEyB8qwe0NKUgXSFC2Q/SrhLTO6dqK1I5Oh3Fy1ee7vKG KmCHfhwXtfT+929h1ysUtrdA/cXnnTEYHxIbH+8iDpLjy2ALs7VelniLqvtswrcaoXBK T7wA== X-Gm-Message-State: ALoCoQkcXnQrI/ENu6lD74sGecIO2fB+w7OaUHLHSq94ZmgLy3FoT3hWD9h4hmhy0oDtAVVe9mk4 X-Received: by 10.224.55.129 with SMTP id u1mr2099844qag.6.1391451413512; Mon, 03 Feb 2014 10:16:53 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.101 with SMTP id y92ls1972091qgy.92.gmail; Mon, 03 Feb 2014 10:16:53 -0800 (PST) X-Received: by 10.52.30.167 with SMTP id t7mr1484000vdh.36.1391451413418; Mon, 03 Feb 2014 10:16:53 -0800 (PST) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by mx.google.com with ESMTPS id p9si1565262vdv.70.2014.02.03.10.16.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Feb 2014 10:16:53 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.53; Received: by mail-vb0-f53.google.com with SMTP id p17so5006697vbe.12 for ; Mon, 03 Feb 2014 10:16:53 -0800 (PST) X-Received: by 10.58.169.7 with SMTP id aa7mr2882592vec.24.1391451413329; Mon, 03 Feb 2014 10:16:53 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp174187vcz; Mon, 3 Feb 2014 10:16:52 -0800 (PST) X-Received: by 10.68.249.100 with SMTP id yt4mr4099826pbc.165.1391451412447; Mon, 03 Feb 2014 10:16:52 -0800 (PST) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id of8si8709634pbc.223.2014.02.03.10.16.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Feb 2014 10:16:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id p10so7125144pdj.17 for ; Mon, 03 Feb 2014 10:16:52 -0800 (PST) X-Received: by 10.68.139.73 with SMTP id qw9mr38330277pbb.121.1391451412000; Mon, 03 Feb 2014 10:16:52 -0800 (PST) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id y9sm150496099pas.10.2014.02.03.10.16.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Feb 2014 10:16:51 -0800 (PST) From: John Stultz To: LKML Cc: Laura Abbott , Greg KH , Colin Cross , Android Kernel Team , John Stultz Subject: [PATCH 14/16] staging: ion: Fix ION_IOC_FREE compat ioctl Date: Mon, 3 Feb 2014 10:16:26 -0800 Message-Id: <1391451388-23906-15-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391451388-23906-1-git-send-email-john.stultz@linaro.org> References: <1391451388-23906-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.53 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Laura Abbott The compat ioctl for ION_IOC_FREE currently passes allocation data instead of the free data. Correct this. Cc: Greg KH Cc: Colin Cross Cc: Android Kernel Team Signed-off-by: Laura Abbott [jstultz: Folded in a small build fix] Signed-off-by: John Stultz --- 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;