Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1243264imw; Tue, 5 Jul 2022 06:19:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMAn2eFbw1K5Gy734K/N+sZHOElQA0s5KoB1kgl1jUVbLUme478dEqMaVC1RYb2X8B2Tos X-Received: by 2002:a63:7555:0:b0:40c:f8be:af36 with SMTP id f21-20020a637555000000b0040cf8beaf36mr29468559pgn.6.1657027170830; Tue, 05 Jul 2022 06:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657027170; cv=none; d=google.com; s=arc-20160816; b=LxXwiz9aFpwoDeciZUMCyFDSlhvx/wlyATsnGsEtd+JhTieMosT7sGiBAY9Brg6Tjr jBO7NXuobpJeltetYKUGmpDGbSJfJbq3E1hwi80ivGPoRsQYk91CXuY+mOdFxHUQ/2HA 3+NQrkxhZ3wrcRuPCOSZDeRLQE8gOY2aEHZj3U+uUMaQyLxKquCuMikGB3MrSLGjA9A9 u4MWV2788ARrGHDrSUPWcB7IRUaasS+HT/siPzN58aWCvo8j8PkO5XNYIC9dBKpVMpnX ai8csMFsGEqzPBww/JBkg4kGfE7VIVeq74nkefYiRx4Sab91nqvrd2fbh/VEFzES8897 C/OA== 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=axxSDpD9BgUgpO8SkrfbpLWiYSueXXQEMdAjIoBm/fVmRy5WZubbb57v61ycx2JdXT u6drYa1j5GIWImOF1Zma+1UcjIwkDIqtAE142xOm+QVHXCGtLXssRl3TC9eOQyVbZkzZ wV9sA+ruevT67rSH2feNcU/3pK4dY5oMD9SfG8suEX1aP+nS2UDwF0OqsQoh5CcaL4aE 3+3iCTg1hqM5zY+6zfFBqabNAhVIGL7Z64X7PDAF7XkRnLJMGOH5VcbHopzJU2nHOdCe CbtbRaN6CYYOerngqZa8aNm9Me1QeP0MQQUjyi7doHsf91o+ZCAWS3Fpr1JHE573FhQe kc1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qVTW77NA; 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 b17-20020a639311000000b0040d66bdc763si41883957pge.857.2022.07.05.06.19.19; Tue, 05 Jul 2022 06:19:30 -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=qVTW77NA; 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 S232477AbiGEME6 (ORCPT + 99 others); Tue, 5 Jul 2022 08:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232577AbiGEMCz (ORCPT ); Tue, 5 Jul 2022 08:02:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF98E17E28; Tue, 5 Jul 2022 05:02:54 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8C43161840; Tue, 5 Jul 2022 12:02:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99CACC341C7; Tue, 5 Jul 2022 12:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657022574; bh=edsKe0FVOvsRAYwbS5XjA2Hdnp3PFY86vrBZUlfMG/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qVTW77NAgPUkGmDxTMV2wm1/CuwG4uqXziTk2npJ9Q0sQV0dGr3BQGnlKa2bKx9qG tvdnUJakLlsF4avu0hjXhvNw1EjtvR6tVdE5UDJ1RMS7GwzykTkG60RHCAnDjxUydR t8U8oJ0AvAv1EVqFDKL0ROKvWz7gTAnoaucIid9M= 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.19 05/33] SUNRPC: Fix READ_PLUS crasher Date: Tue, 5 Jul 2022 13:57:57 +0200 Message-Id: <20220705115606.868578059@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115606.709817198@linuxfoundation.org> References: <20220705115606.709817198@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;