Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2204599pxb; Sun, 30 Jan 2022 08:16:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxK7yf07KuspIq75JgOzpVnX3g9eOuNwCvKcEp/QDuvuANeS1xbthSL1iEh7u4zISxCzfDn X-Received: by 2002:a17:906:5d0a:: with SMTP id g10mr13822620ejt.37.1643559365930; Sun, 30 Jan 2022 08:16:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643559365; cv=none; d=google.com; s=arc-20160816; b=O5D5mqzwsDndeKVy7ZvQimzpm6MgDivSy+MOqOpuvR2fTe/ICw+9C2nHqNdqRxWTNy iu2Zvv0DhKYVPBFcWjPMsImlvLA80Oc1s2wtovFenjnxJN1es6JYMSHOHyjvg6AwqhYo 18faNHemj0/YBQ84k4UFg2tlIUQ9eo4ck3+2K46EOVw5/V/ouyjY5i5ERU2NXAe+tKTz yvRsdbEOLGGECx/iZzMNAa6ybydzzATc0U8rJ/JrwuB6/umE8Sasj1kzK2j0E7lWQQe3 +gA0hGrnI58ziUHgWd5w89uVy1KDgA54MyWHO9qA5SCnrkso25ZGGlJVTIi7BnqCn5/z VCoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=jM/BKltAvaKt1TSq7jZDJG2pBbF443I8zAZm1kBkHro=; b=gYNVdHsYkDAZ9MM0d3qz8O2tR8Fq11NgGvqOK//jsyEnXkXTuBYjJGSWv32M4RuZmF bYUonQxBKGKHYxjq+pSAZ1PQnzMcEETQcKHg4NpnWFGzSf7f/OEi+HCOx89hpDxWXqfK i9MnM6KSEwBvAatViBasiWuC4CiEbs8pO4NoFdoSI2Ay/UtPdbg0FnobpkhQM37ekXkI 13mxc4gv2v8qpNu8L3IFaXX3fjH4kY0YcDDpjr8GnFnHtGesdKnwh0LZacKHbmzaEwWP XXCefHLLI4ObfiNAK8fT0n0F8NkiQCYzaNmwxIUCUIkH+e5UIqgW5JBClbTiLBiZnhUS PQFg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gt34si5886285ejc.316.2022.01.30.08.15.41; Sun, 30 Jan 2022 08:16:05 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243398AbiA1IsT (ORCPT + 99 others); Fri, 28 Jan 2022 03:48:19 -0500 Received: from out30-130.freemail.mail.aliyun.com ([115.124.30.130]:48743 "EHLO out30-130.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240484AbiA1IsR (ORCPT ); Fri, 28 Jan 2022 03:48:17 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04407;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0V31Qcf-_1643359694; Received: from 30.240.99.245(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0V31Qcf-_1643359694) by smtp.aliyun-inc.com(127.0.0.1); Fri, 28 Jan 2022 16:48:15 +0800 Message-ID: <16ac38b7-6a3a-9f18-b8fa-ca3bfe053504@linux.alibaba.com> Date: Fri, 28 Jan 2022 16:48:07 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] fs: remove duplicate permission checks in do_sendfile() Content-Language: en-US To: Alexander Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org References: <20211130080218.22517-1-tianjia.zhang@linux.alibaba.com> From: Tianjia Zhang In-Reply-To: <20211130080218.22517-1-tianjia.zhang@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ping. Thanks. On 11/30/21 4:02 PM, Tianjia Zhang wrote: > The permission check for out.file is mainly performed in the function > rw_verify_area(), and this check is called twice in the function > do_splice_direct() and before calling do_splice_direct(). This is a > redundant check and it is necessary to remove. > > Signed-off-by: Tianjia Zhang > --- > fs/read_write.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/fs/read_write.c b/fs/read_write.c > index 0074afa7ecb3..bc7c3fcc3400 100644 > --- a/fs/read_write.c > +++ b/fs/read_write.c > @@ -1238,9 +1238,6 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, > #endif > opipe = get_pipe_info(out.file, true); > if (!opipe) { > - retval = rw_verify_area(WRITE, out.file, &out_pos, count); > - if (retval < 0) > - goto fput_out; > file_start_write(out.file); > retval = do_splice_direct(in.file, &pos, out.file, &out_pos, > count, fl);