From patchwork Wed Feb 5 00:08:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 24153 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 57A90202FA for ; Wed, 5 Feb 2014 00:09:23 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id c14sf25928867vea.3 for ; Tue, 04 Feb 2014 16:09:22 -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=hkN8oeQc5IrZ4gk9FzQPyhuask2g6WghKEnZQ3arpBC+Mm0mOyqIaXHfzA8GXfZnkD SfVLKzUiEaZ5krhYsEikx7GV6tGANYMA22IomZBmTMtFM13+pZHJLTOJFfEnlDi1uQe1 YATw6G4mi8onKtpM1PeDXR+4oNPn2JWxLybOhEL7H7Wq7GoVd905kXAtQAhanaG3KV3e EKVaGwJoMCyr+lUPNsAg+hgyPISYOJox4LnrlNSI1lNL+mh3ASuLtcZvUi+Aw0WIVjuv +TbEpOstZ9ZU8pa7fs4IF/+ZCEtAb42ZhoFaMsuLw57mc9FZsDqrTJSTvRQtnOQaZSLq X6bQ== X-Gm-Message-State: ALoCoQkM7WMGR8quMNkv8QNaIuy4tjegdaoEyu0UweVk7vxVvff0hypNG3ppH7YmZdL/Yl++cx71 X-Received: by 10.58.189.73 with SMTP id gg9mr17378984vec.34.1391558962232; Tue, 04 Feb 2014 16:09:22 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.239 with SMTP id 102ls2626432qgx.23.gmail; Tue, 04 Feb 2014 16:09:22 -0800 (PST) X-Received: by 10.52.189.33 with SMTP id gf1mr9615773vdc.26.1391558962091; Tue, 04 Feb 2014 16:09:22 -0800 (PST) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id tj7si8964433vdc.124.2014.02.04.16.09.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 16:09:22 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ks9so6480632vcb.11 for ; Tue, 04 Feb 2014 16:09:22 -0800 (PST) X-Received: by 10.220.95.139 with SMTP id d11mr11296504vcn.21.1391558961911; Tue, 04 Feb 2014 16:09:21 -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 u4csp4090vcz; Tue, 4 Feb 2014 16:09:21 -0800 (PST) X-Received: by 10.68.139.100 with SMTP id qx4mr17002049pbb.144.1391558961005; Tue, 04 Feb 2014 16:09:21 -0800 (PST) Received: from mail-pd0-f169.google.com (mail-pd0-f169.google.com [209.85.192.169]) by mx.google.com with ESMTPS id eb3si26573021pbd.287.2014.02.04.16.09.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 16:09:21 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.169 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.169; Received: by mail-pd0-f169.google.com with SMTP id v10so8957203pde.0 for ; Tue, 04 Feb 2014 16:09:20 -0800 (PST) X-Received: by 10.68.66.103 with SMTP id e7mr46682977pbt.120.1391558960516; Tue, 04 Feb 2014 16:09:20 -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 g6sm181483447pat.2.2014.02.04.16.09.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 16:09:19 -0800 (PST) From: John Stultz To: LKML Cc: Laura Abbott , Greg KH , Colin Cross , Android Kernel Team , John Stultz Subject: [PATCH 6/7] staging: ion: Fix ION_IOC_FREE compat ioctl Date: Tue, 4 Feb 2014 16:08:39 -0800 Message-Id: <1391558920-31590-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1391558920-31590-1-git-send-email-john.stultz@linaro.org> References: <1391558920-31590-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.220.180 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;