Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp780149ybj; Thu, 7 May 2020 07:30:16 -0700 (PDT) X-Google-Smtp-Source: APiQypKEJ07uv5sXHv7GWS5qiIbBfS8lOphu+Fd2BiS12rRfA8Qi+oHdlWqPTxsnK1fjgniU+0Kl X-Received: by 2002:a17:906:2b96:: with SMTP id m22mr12173293ejg.330.1588861816669; Thu, 07 May 2020 07:30:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588861816; cv=none; d=google.com; s=arc-20160816; b=Z9gnlUttRRCdrzBZpFErLu3a5tWlr1H2mywfotZogiqyu2xewRq45E5y5RG0DLnHMY sDa5vuBfBjscn6y6Wx6HYMIJ1uH5DObmqN2z+74tSxHOrigqCmEorsuyenSGw85ymjGB eewpXNRDC9CHEK5eHMTqt0lXnaAJwo1cbU3qh0qrLWlDpKqQ5Mjbeh44nHctTEpkcleL RMYU5PHygB3vPmysMGA5fJNTnQ9iKq+nqWoSyMtOhgq8OYe4A52WQ3BpsfhpxFgmwowu MWf+MeuCsiMQKuslAu/o6qAPxn6C6a9u8kI2/e3Npy3eW7+ImZPvkyo70GJMSh1L/ybW D6PA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EfkpqmUAWPpxRmrK97E92U/iBzL2h/q/cWK4I7/XDI4=; b=GdXT+Z15VEI4QQTCbfbt9LMnmRMuCLgwew4pZyuu5OE2XzgqGmOM1nM1ji48eB9cCm Wx+OSNAZoRbVYI4FFRHiqoK/NYsrbY5DSXiDzMQLuZ4NzvAN0hsHnapNvAcammbLo6pT KAdLFVI7to+JF1uznVW0HOkM5A2v8pT/aa70gK02DktZmSlVq4Tplm8ppZS1QMS/9dOI CVXEIB6ITnTaPOhGXsvfdeuPBN7v2Z5aJvQznpvut/htJBgIpX4Qi6v8isiaqdUqJSXl GyC+5io2mxRpGo2e52DizPcHRseF4dBY4ruSwe10RC7sIv/v9CMJCsR+l1BSwNFVl+RG 7CNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TOEBOY4l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si1023974edk.17.2020.05.07.07.29.51; Thu, 07 May 2020 07:30:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TOEBOY4l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727898AbgEGO2A (ORCPT + 99 others); Thu, 7 May 2020 10:28:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:54018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727867AbgEGO16 (ORCPT ); Thu, 7 May 2020 10:27:58 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 71A1020A8B; Thu, 7 May 2020 14:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588861677; bh=jpYLgPba2W2cjLL8grkS1iQbCs1US7rxH2gsLmc3ELo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TOEBOY4lqdVDquf5/8fqLBrAfG5BLUYyJdAcFl6XXosQ1pmx5nTTs6ak9zglXwbZ5 koE8l0y8c1hoYUAfJAAX4Ct+eeeylD8N6X/dk2GMm7zPyYyO3tHqh3M8xCvC17u4xJ QusFnX9MGM3zojYJgbhSfK/2j0d/a5xxX4TRAglM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Daniel Vetter , Sumit Semwal , Chenbo Feng , Greg Hackmann , Daniel Vetter , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, minchan@kernel.org, surenb@google.com, jenhaochen@google.com, Martin Liu , Sasha Levin , dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 5.6 25/50] dma-buf: Fix SET_NAME ioctl uapi Date: Thu, 7 May 2020 10:27:01 -0400 Message-Id: <20200507142726.25751-25-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200507142726.25751-1-sashal@kernel.org> References: <20200507142726.25751-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Vetter [ Upstream commit a5bff92eaac45bdf6221badf9505c26792fdf99e ] The uapi is the same on 32 and 64 bit, but the number isn't. Everyone who botched this please re-read: https://www.kernel.org/doc/html/v5.4-preprc-cpu/ioctl/botching-up-ioctls.html Also, the type argument for the ioctl macros is for the type the void __user *arg pointer points at, which in this case would be the variable-sized char[] of a 0 terminated string. So this was botched in more than just the usual ways. Cc: Sumit Semwal Cc: Chenbo Feng Cc: Greg Hackmann Cc: Daniel Vetter Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org Cc: minchan@kernel.org Cc: surenb@google.com Cc: jenhaochen@google.com Cc: Martin Liu Signed-off-by: Daniel Vetter Tested-by: Martin Liu Reviewed-by: Martin Liu Signed-off-by: Sumit Semwal [sumits: updated some checkpatch fixes, corrected author email] Link: https://patchwork.freedesktop.org/patch/msgid/20200407133002.3486387-1-daniel.vetter@ffwll.ch Signed-off-by: Sasha Levin --- drivers/dma-buf/dma-buf.c | 3 ++- include/uapi/linux/dma-buf.h | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c index c343c7c10b4cc..e7589d91de8fb 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -388,7 +388,8 @@ static long dma_buf_ioctl(struct file *file, return ret; - case DMA_BUF_SET_NAME: + case DMA_BUF_SET_NAME_A: + case DMA_BUF_SET_NAME_B: return dma_buf_set_name(dmabuf, (const char __user *)arg); default: diff --git a/include/uapi/linux/dma-buf.h b/include/uapi/linux/dma-buf.h index dbc7092e04b5a..7f30393b92c3b 100644 --- a/include/uapi/linux/dma-buf.h +++ b/include/uapi/linux/dma-buf.h @@ -39,6 +39,12 @@ struct dma_buf_sync { #define DMA_BUF_BASE 'b' #define DMA_BUF_IOCTL_SYNC _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync) + +/* 32/64bitness of this uapi was botched in android, there's no difference + * between them in actual uapi, they're just different numbers. + */ #define DMA_BUF_SET_NAME _IOW(DMA_BUF_BASE, 1, const char *) +#define DMA_BUF_SET_NAME_A _IOW(DMA_BUF_BASE, 1, u32) +#define DMA_BUF_SET_NAME_B _IOW(DMA_BUF_BASE, 1, u64) #endif -- 2.20.1