Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2272DC433EF for ; Thu, 16 Dec 2021 16:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239524AbhLPQeK (ORCPT ); Thu, 16 Dec 2021 11:34:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232915AbhLPQeJ (ORCPT ); Thu, 16 Dec 2021 11:34:09 -0500 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BE7FC061574 for ; Thu, 16 Dec 2021 08:34:09 -0800 (PST) Received: by mail-ed1-x532.google.com with SMTP id o20so89411283eds.10 for ; Thu, 16 Dec 2021 08:34:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fkh9SA21WJAwLXrex3D5hDMvc6XDF8J0dz4irJ+Ae9Y=; b=TZ91WtmX33bYGxQ28DYuwMlA4L/Ykfses9BBTD3iJ52Q9qh/2tU+S4awSqTTbNIEfO NIVIGXtvrTssU7E/Ib+EszfgqaQI3Ug/c2E/ITq3PkTvuJKpkp8KHKAP+FyMLrxxfyHm 7LDKJiXUmfROJo2atlx1zLIBfA58BXXUjM6Yc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fkh9SA21WJAwLXrex3D5hDMvc6XDF8J0dz4irJ+Ae9Y=; b=seCYh+u/a34wfgoBhZLGA44a9L6AgM//Hnf+fjoAcvOZBGjSRDP+bYVZFl7aTl3WnA 5N5jKMm6HCcVcoxmETc6ltuEF3puJDgtbEXs6pArJtYcORBTjhN6sKQ8VkjLmyPLkttL COzGPxpfFIRqpGwTT2KtPgMs88hC1wLG+rDQMQcostGjvDivyxHJKQz5ubFSep7ecl02 2bqJpPBkeZshB8SNjCUT0dyoUj+47H3gcH3JuI5WCLKDBlNRXCzAmYpW8EEGjEFFIW6c CyIgEfubZF9X1VJxryVMF//drnMGWl9ygxVuJa19enKybAzNnKe9VozQs04DtapbmzAQ sasQ== X-Gm-Message-State: AOAM531hKS1NxnLT1yOwyowSnhU+qd8oEcIWudLa8yWr/W0X3u1vXk9c ijvFzFgvNFCpziCB0yofRBBF2BJOvw5BR51P2RI= X-Google-Smtp-Source: ABdhPJyik2j+H54eF0+84PC48i61xqBWCCx71ffxtlGTAVav3ypIINIryLFv9Xkjad9RXPw9rKI3Aw== X-Received: by 2002:a05:6402:1d50:: with SMTP id dz16mr20783918edb.385.1639672447011; Thu, 16 Dec 2021 08:34:07 -0800 (PST) Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com. [209.85.208.49]) by smtp.gmail.com with ESMTPSA id m6sm2725867edc.36.2021.12.16.08.34.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Dec 2021 08:34:06 -0800 (PST) Received: by mail-ed1-f49.google.com with SMTP id o20so89411139eds.10 for ; Thu, 16 Dec 2021 08:34:06 -0800 (PST) X-Received: by 2002:a5d:6211:: with SMTP id y17mr9727999wru.97.1639672086343; Thu, 16 Dec 2021 08:28:06 -0800 (PST) MIME-Version: 1.0 References: <163967073889.1823006.12237147297060239168.stgit@warthog.procyon.org.uk> <163967172373.1823006.6118195970180365070.stgit@warthog.procyon.org.uk> In-Reply-To: <163967172373.1823006.6118195970180365070.stgit@warthog.procyon.org.uk> From: Linus Torvalds Date: Thu, 16 Dec 2021 08:27:50 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 57/68] afs: Fix afs_write_end() to handle len > page size To: David Howells Cc: linux-cachefs@redhat.com, Jeff Layton , Marc Dionne , Matthew Wilcox , linux-afs@lists.infradead.org, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Alexander Viro , Omar Sandoval , JeffleXu , "open list:NFS, SUNRPC, AND..." , CIFS , ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 16, 2021 at 8:22 AM David Howells wrote: > > It is possible for the len argument to afs_write_end() to overrun the end > of the page (len is used to key the size of the page in afs_write_start() > when compound pages become a regular thing). This smells like a bug in the caller. It's just insane to call "write_end()" with a range that doesn't actually fit in the page provided. Exactly how does that happen, and why should AFS deal with it, not whoever called write_end()? Linus