Message ID | 20230515061923.767680-1-suhui@nfschina.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6706407vqo; Sun, 14 May 2023 23:31:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ61lxYS6oPXW6oaSUNaYD7aphyxtDNI83F8mDv9sPSQfVK0s+QKmJAj1RTghNppgTGdbJlQ X-Received: by 2002:a17:902:ef96:b0:1aa:ce4d:c77d with SMTP id iz22-20020a170902ef9600b001aace4dc77dmr30940797plb.24.1684132300161; Sun, 14 May 2023 23:31:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684132300; cv=none; d=google.com; s=arc-20160816; b=OryNvzRPC/SjiWVpe8I2aQvKf4clYXceuK8r/r8t1iNgku//VPoQEx5cPKD3j3L8ik VWzgRtmGO8Y1Js3NqCOf8RZKivnKWiOSFSV8TfKyKLrLyTsVZ8oVgocFSkP3BWQ1FZfu LCkNR/nPNnZV62Fqi55aWTs02Cm3mE88sdshD/heLKBEQRkX37EAWGtjc1a+il9AwGx0 /bPf93GkKEjSBe3C0fLu1TZ5uDzg16nMvnemVnQDD0OEeznbD0V5w/JLvahqzXH7fglc 5eEPStJUYG9n4UcFwYrTwQdG1Pan1/j3sCpTuPHAEzprCIPqprOfwqyQsEOv3tQrxvn9 Zj1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=aIXZetLJ4wDIJh1HKyonIBy27ceb78zlT/q3IrwhK/0=; b=JaOmoOhmkuWUxcr27xUpDW4nsEN8YH4vUum4SnGC26lpo6/cyHoWWhtJRxaG+hyVgt kA9BoUQtV5YURSZvdCg1tP0fePErGNeI7Y0KwbPyVB4Amp/5BsQObTJ4kpbs8X2p+UEu QLIvGYixykKeuFR9U3/i4Fz+FCIjc8fs75k/4M1LugQx5Te97Uq99yXivVcKDtUu1f+W sxeE/QQj6jJa2w/SgyCkJ8F0JeK9jvDkjI0ILqCqFVPV1EyenVElTQ+wleoLGQQKWgNO vnLn3AcxH+t+Y2wcKHFHneHnCZwZshEDfRv5+hPtmICeNUVuoh16QANceaJsnZSz26Da Jx0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je20-20020a170903265400b001ae001e8bc9si4411371plb.188.2023.05.14.23.31.24; Sun, 14 May 2023 23:31:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238670AbjEOGTo (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Mon, 15 May 2023 02:19:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbjEOGTm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 15 May 2023 02:19:42 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 9E24E1722; Sun, 14 May 2023 23:19:37 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id 1007018011BD54; Mon, 15 May 2023 14:19:28 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui <suhui@nfschina.com> To: Jan Harkes <jaharkes@cs.cmu.edu>, coda@cs.cmu.edu Cc: codalist@coda.cs.cmu.edu, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Su Hui <suhui@nfschina.com> Subject: [PATCH] coda: return -EFAULT if copy fails Date: Mon, 15 May 2023 14:19:23 +0800 Message-Id: <20230515061923.767680-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,RDNS_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765940710384542891?= X-GMAIL-MSGID: =?utf-8?q?1765940710384542891?= |
Series |
coda: return -EFAULT if copy fails
|
|
Commit Message
Su Hui
May 15, 2023, 6:19 a.m. UTC
The copy_to/from_user() functions should return -EFAULT instead of -EINVAL.
Signed-off-by: Su Hui <suhui@nfschina.com>
---
fs/coda/upcall.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Mon, May 15, 2023 at 02:19:23PM +0800, Su Hui wrote: > The copy_to/from_user() functions should return -EFAULT instead of -EINVAL. > > Signed-off-by: Su Hui <suhui@nfschina.com> > --- Could you add a Fixes tag? regards, dan carpenter
Le 15/05/2023 à 08:19, Su Hui a écrit : > The copy_to/from_user() functions should return -EFAULT instead of -EINVAL. Hi, just for my understanding, why? Even if not perfect: git grep -A1 copy_from_user | grep EINV | wc -l 15 git grep -A1 copy_to_user | grep EINV | wc -l 12 CJ > > Signed-off-by: Su Hui <suhui@nfschina.com> > --- > fs/coda/upcall.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c > index cd6a3721f6f6..1517dc3bd592 100644 > --- a/fs/coda/upcall.c > +++ b/fs/coda/upcall.c > @@ -510,7 +510,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, > /* get the data out of user space */ > if (copy_from_user((char *)inp + (long)inp->coda_ioctl.data, > data->vi.in, data->vi.in_size)) { > - error = -EINVAL; > + error = -EFAULT; > goto exit; > } >
On 2023/5/15 15:35, Dan Carpenter wrote: > On Mon, May 15, 2023 at 02:19:23PM +0800, Su Hui wrote: >> The copy_to/from_user() functions should return -EFAULT instead of -EINVAL. >> >> Signed-off-by: Su Hui <suhui@nfschina.com> >> --- > Could you add a Fixes tag? Hi, This doesn't seem like a bug. So I think Fixes tag should not be used here. Thanks for your reply! Su Hui > regards, > dan carpenter >
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index cd6a3721f6f6..1517dc3bd592 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c @@ -510,7 +510,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, /* get the data out of user space */ if (copy_from_user((char *)inp + (long)inp->coda_ioctl.data, data->vi.in, data->vi.in_size)) { - error = -EINVAL; + error = -EFAULT; goto exit; }