Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp267254ybz; Tue, 28 Apr 2020 23:17:19 -0700 (PDT) X-Google-Smtp-Source: APiQypJvmMnaLGQc5b/NY/7Cf5mBmjsEtQY5SAom6VwHi9O8iuaXu8pxjR+o7tqQVMJBEl7Rn+kB X-Received: by 2002:a17:906:4907:: with SMTP id b7mr1077367ejq.279.1588141039126; Tue, 28 Apr 2020 23:17:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588141039; cv=none; d=google.com; s=arc-20160816; b=MEYHSKPErm9e8Q3aO2QTle2KKQU/x/zjzZQOvfUKGT8PVyDZOvsq67v2YO8I+mg9dy EIrHfYY2iLblVrsEyFl15AjOgcqTrSuoXJwnk7l6dR5DRT/d08hZcVyyFu1lUEzLH2LQ fPSvt4DhQxC0Y9loun7BWWqn8GQKb+xDQw+PfHrXAbi83wbVDdBO3CrIsTYaqT2eg9JG b/fh+1lJRupogvf+RYviaAklUn0baNHtptZBv9o0/JnXspzfilmel9B1NG11gQMfQJf3 fAmzJmB7yoD+pJc+cfce+1JgFmDGPfQbwW6uWYacaDEUkeOcSDpPu/aWsUsAbtWyKLcS akZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yr/ssRzEdEkhytQjk3bh27y4Saf9R47ZjJ9MeP9P3h0=; b=xv6I0UNtMi7ZtOC+tllCZ6oPVZW9L00kK5eq/Phyjb7us9bKECgI6EFTUj+pbltBGx bkhvxtOnMLX2ot6OTA+EdquXu74XsopPKWLpB5M6R4OngXwwp8yJ9D/O7OH1gqlzuok+ 5dsvvQ+jEurxfeCs33wNqbMYkwxkrplKDE5HFLDcClzggf+JxLr/kB+Spe17i/v0Olmw AA2Ho6mN1/voduTppyGB3ycpwCh4HOdfCQDF5GSpglgL9ykkbCZD1yH0+LxOj9LZT5WA XILzsGmxdrhUJQmWa68SZ4qSfrdoLv/HuUhQY0rQpzaHSzHWnhmd2k8i+hkYGvZomD78 qg6g== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l19si3283894ejq.122.2020.04.28.23.16.56; Tue, 28 Apr 2020 23:17:19 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726564AbgD2GPS (ORCPT + 99 others); Wed, 29 Apr 2020 02:15:18 -0400 Received: from verein.lst.de ([213.95.11.211]:60897 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726181AbgD2GPR (ORCPT ); Wed, 29 Apr 2020 02:15:17 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 18D8168CF0; Wed, 29 Apr 2020 08:15:15 +0200 (CEST) Date: Wed, 29 Apr 2020 08:15:14 +0200 From: Christoph Hellwig To: Jeremy Kerr Cc: Christoph Hellwig , Linus Torvalds , Arnd Bergmann , "Eric W . Biederman" , Andrew Morton , Alexander Viro , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH] powerpc/spufs: fix copy_to_user while atomic Message-ID: <20200429061514.GD30946@lst.de> References: <20200427200626.1622060-2-hch@lst.de> <20200428120207.15728-1-jk@ozlabs.org> <20200428171133.GA17445@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org And another one that should go on top of this one to address Al's other compaint: --- From 1b7ced3de0b3a4addec61f61ac5278c3ff141657 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 22 Apr 2020 09:05:30 +0200 Subject: powerpc/spufs: stop using access_ok Just use the proper non __-prefixed get/put_user variants where that is not done yet. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/cell/spufs/file.c | 42 +++++------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index b4e1ef650b406..cd7d10f27fad1 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c @@ -590,17 +590,12 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf, size_t len, loff_t *pos) { struct spu_context *ctx = file->private_data; - u32 mbox_data, __user *udata; + u32 mbox_data, __user *udata = (void __user *)buf; ssize_t count; if (len < 4) return -EINVAL; - if (!access_ok(buf, len)) - return -EFAULT; - - udata = (void __user *)buf; - count = spu_acquire(ctx); if (count) return count; @@ -616,7 +611,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf, * but still need to return the data we have * read successfully so far. */ - ret = __put_user(mbox_data, udata); + ret = put_user(mbox_data, udata); if (ret) { if (!count) count = -EFAULT; @@ -698,17 +693,12 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf, size_t len, loff_t *pos) { struct spu_context *ctx = file->private_data; - u32 ibox_data, __user *udata; + u32 ibox_data, __user *udata = (void __user *)buf; ssize_t count; if (len < 4) return -EINVAL; - if (!access_ok(buf, len)) - return -EFAULT; - - udata = (void __user *)buf; - count = spu_acquire(ctx); if (count) goto out; @@ -727,7 +717,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf, } /* if we can't write at all, return -EFAULT */ - count = __put_user(ibox_data, udata); + count = put_user(ibox_data, udata); if (count) goto out_unlock; @@ -741,7 +731,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf, * but still need to return the data we have * read successfully so far. */ - ret = __put_user(ibox_data, udata); + ret = put_user(ibox_data, udata); if (ret) break; } @@ -836,17 +826,13 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf, size_t len, loff_t *pos) { struct spu_context *ctx = file->private_data; - u32 wbox_data, __user *udata; + u32 wbox_data, __user *udata = (void __user *)buf; ssize_t count; if (len < 4) return -EINVAL; - udata = (void __user *)buf; - if (!access_ok(buf, len)) - return -EFAULT; - - if (__get_user(wbox_data, udata)) + if (get_user(wbox_data, udata)) return -EFAULT; count = spu_acquire(ctx); @@ -873,7 +859,7 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf, /* write as much as possible */ for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) { int ret; - ret = __get_user(wbox_data, udata); + ret = get_user(wbox_data, udata); if (ret) break; @@ -1982,9 +1968,6 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf, u32 stat, data; int ret; - if (!access_ok(buf, len)) - return -EFAULT; - ret = spu_acquire_saved(ctx); if (ret) return ret; @@ -2028,9 +2011,6 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf, u32 stat, data; int ret; - if (!access_ok(buf, len)) - return -EFAULT; - ret = spu_acquire_saved(ctx); if (ret) return ret; @@ -2082,9 +2062,6 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf, u32 data[ARRAY_SIZE(ctx->csa.spu_mailbox_data)]; int ret, count; - if (!access_ok(buf, len)) - return -EFAULT; - ret = spu_acquire_saved(ctx); if (ret) return ret; @@ -2143,9 +2120,6 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf, struct spu_dma_info info; int ret; - if (!access_ok(buf, len)) - return -EFAULT; - ret = spu_acquire_saved(ctx); if (ret) return ret; -- 2.26.2