Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1250465imw; Tue, 5 Jul 2022 06:26:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tmYwEd8pKm+XMP12zG9UW9yPF7XplEmKH9gDqOQx6oV+oUEoohFeNljdHBaG6JdBhCIMr5 X-Received: by 2002:a17:90a:f8d1:b0:1ef:8795:c7e with SMTP id l17-20020a17090af8d100b001ef87950c7emr13233386pjd.74.1657027579110; Tue, 05 Jul 2022 06:26:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657027579; cv=none; d=google.com; s=arc-20160816; b=mRrt4a7Y/oEBXnxEbVc5ubc2uQKRtqaGjtC3FEvcMRO4GW7vLrOTFjMKyoK0scRtqr Ee/xPMHBLC93XEQwR+7HvknjwZCUhNJ3rIofpok1b4DVnZhnQmAaTr3a7W2//G1nlNsn 6VYeFnF6RD6/QPMPR4ZlxLI4PWXxDiGn5PZ5Zwi7Yp7C171e5XsmIoKUNfSo0aaJ5ZOt oS9eML7b3uzlCQmQJGfEGW4vxUtYHFaGrSiWnyAjNZansII1K/72IWVEmpHNHuY6E5m+ wtVOgB7maTE0BmF9BKjES1vkNNp/YqZm0E5cxiWoUdCJmSgpqbYvhzvuIEXIl7f+2OE8 kwHg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=o+/529VLTyGGheKBozVkPxsxYW+vNTVi1VJm6/KfzuA=; b=wPiAxr0FJ/bTu9h3ts9zdgSQ1s/EE6BQ8HUyi4FjNticKaXYpWw/4aKgesaoBLBD5/ a8j7+vas/+lPcCQaWVntiQZZgMJ9D0ylpaexT6zTizcAbzWXc7E9KDrUIkQVDe4ot+kH NRT4khXGZWWdP/nYjjBXqsbrDhFkGDqLZWV3MxFltTd9VkFmLQOJ9UaqLtTKZoiJmYTA nk6icQuspUq60E+u7mxYTx94ojOxdppm+VKsG7MccI8c3FM2ZFe6lzeaR1GM5/JUMi7U xdpoIMQlfX8VFAGiepJ43idt5WxuNNzE2F8FSO+KZ1PezIny7Gxw6L13Y4O9tDz3lU2P X/CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uTlF/f/I"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 79-20020a630152000000b003fbc1902fe6si11823293pgb.706.2022.07.05.06.26.07; Tue, 05 Jul 2022 06:26:19 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="uTlF/f/I"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233557AbiGEMD0 (ORCPT + 99 others); Tue, 5 Jul 2022 08:03:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233088AbiGEMCK (ORCPT ); Tue, 5 Jul 2022 08:02:10 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A83D183B8; Tue, 5 Jul 2022 05:01:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 6E2C8CE1B86; Tue, 5 Jul 2022 12:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 598E5C341CB; Tue, 5 Jul 2022 12:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657022510; bh=edsKe0FVOvsRAYwbS5XjA2Hdnp3PFY86vrBZUlfMG/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uTlF/f/IEJVCGELNDUIO8cMdbqMYS/ZAX6XEMN4hwQkwl0eNAYq+WNYLSCIYPBN1H HuqnVsqXxZUbf5yPGjijnh1x01aGT9nM8zJQwdpZM7LMJPsqLmmZEAkapDPtXwh+SO X2AHTRb/vzZeri9Nb/N/7qqz+4ST6GLCEaZDO2T8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruce Fields , Zorro Lang , Chuck Lever Subject: [PATCH 4.14 05/29] SUNRPC: Fix READ_PLUS crasher Date: Tue, 5 Jul 2022 13:57:53 +0200 Message-Id: <20220705115606.500197427@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115606.333669144@linuxfoundation.org> References: <20220705115606.333669144@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org From: Chuck Lever commit a23dd544debcda4ee4a549ec7de59e85c3c8345c upstream. Looks like there are still cases when "space_left - frag1bytes" can legitimately exceed PAGE_SIZE. Ensure that xdr->end always remains within the current encode buffer. Reported-by: Bruce Fields Reported-by: Zorro Lang Link: https://bugzilla.kernel.org/show_bug.cgi?id=216151 Fixes: 6c254bf3b637 ("SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()") Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -544,7 +544,7 @@ static __be32 *xdr_get_next_encode_buffe */ xdr->p = (void *)p + frag2bytes; space_left = xdr->buf->buflen - xdr->buf->len; - if (space_left - nbytes >= PAGE_SIZE) + if (space_left - frag1bytes >= PAGE_SIZE) xdr->end = (void *)p + PAGE_SIZE; else xdr->end = (void *)p + space_left - frag1bytes;