Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3401078imm; Mon, 6 Aug 2018 04:14:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJQ4ebqwAC+nJeU8pYkU6RmcXo62GEi+qP3DftvzWRkRLRrntJnh/1ppUQowDpHT9KVq/C X-Received: by 2002:a17:902:bd82:: with SMTP id q2-v6mr13536357pls.178.1533554096900; Mon, 06 Aug 2018 04:14:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533554096; cv=none; d=google.com; s=arc-20160816; b=Zz+QvgI40+fKtv9on0dX9ZNRjCB161ArE9oZ1i8tlnzQ5GNtAbjS354XtA9nUajLhf cTfFisVjRioD1B/JODH0xNUg0ZUUaD4u3VsZ96GFWzDVEa6g7kkbHUySoqc8NNnyEcDl oWy1Eo0djYMQ38flFnN8M2PbUUZ1MWuA+gFf6rFxFlXjbHO9wNVBrZksjt2cot7NtiaM FaHnfNTsV/ipts9LrRgFplvBiTxMyL8jRL7zGstRPO8hGS0F792XAeb4iLpkzTBCa20E 8qFRjf7PlZfV/DbzUYOuDuPWPtW8Eb448V7a7YBkYHWVT2v9TSfZCZbu7Pq8iClZ4BwR /ctQ== 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:arc-authentication-results; bh=zVD1AV69zQaZ4972IbC5guljYq7c/pg2y58Ps9RLxLo=; b=LKmMamVciOX+XcZOb+z7+i1klPhPsr/u0dKgLfood1h/kMuJ/dSfTM3NkxEIT48RCB xquZgvfF8jAq8hKbv9uD0u30sDIyxnXo+hb54mUnxLDKbWdRnNI2ytS6JnhOuEGhAiXd w4Ri5GPNWsbcgJUijnE0ZSVUgb3ZxrVPSIRo1od4grkomgnXCcoMe5fuBTZgOvj9OZ6s Fn9goE363npJehPlgXLiB2JI2gPsZeFxJO33AXv1hhJwawyLRLGwGX1rRMPjT5npgbqx +Gk7CUkRV+pxiQEu0Lj5xw0r1FD3g17ObYXZGGHfs6BafORTk77LimRSuVtTnTtanI+R 0a2g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si10234773pll.449.2018.08.06.04.14.41; Mon, 06 Aug 2018 04:14:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729679AbeHFMa2 (ORCPT + 99 others); Mon, 6 Aug 2018 08:30:28 -0400 Received: from mx2.suse.de ([195.135.220.15]:38312 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726901AbeHFMa2 (ORCPT ); Mon, 6 Aug 2018 08:30:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 755CBAECB; Mon, 6 Aug 2018 10:22:04 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 9EFBC1E0501; Mon, 6 Aug 2018 12:22:03 +0200 (CEST) Date: Mon, 6 Aug 2018 12:22:03 +0200 From: Jan Kara To: Andrew Morton Cc: Jan Kara , Chengguang Xu , mgorman@techsingularity.net, jlayton@redhat.com, ak@linux.intel.com, mawilcox@microsoft.com, tim.c.chen@linux.intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Al Viro Subject: Re: [PATCH] mm: adjust max read count in generic_file_buffered_read() Message-ID: <20180806102203.hmobd26cujmlfcsw@quack2.suse.cz> References: <20180719081726.3341-1-cgxu519@gmx.com> <20180719085812.sjup2odrjyuigt3l@quack2.suse.cz> <20180720161429.d63dccb9f66799dc0ff74dba@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180720161429.d63dccb9f66799dc0ff74dba@linux-foundation.org> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 20-07-18 16:14:29, Andrew Morton wrote: > On Thu, 19 Jul 2018 10:58:12 +0200 Jan Kara wrote: > > > On Thu 19-07-18 16:17:26, Chengguang Xu wrote: > > > When we try to truncate read count in generic_file_buffered_read(), > > > should deliver (sb->s_maxbytes - offset) as maximum count not > > > sb->s_maxbytes itself. > > > > > > Signed-off-by: Chengguang Xu > > > > Looks good to me. You can add: > > > > Reviewed-by: Jan Kara > > Yup. > > What are the runtime effects of this bug? Good question. I think ->readpage() could be called for index beyond maximum file size supported by the filesystem leading to weird filesystem behavior due to overflows in internal calculations. Honza -- Jan Kara SUSE Labs, CR