Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1253665imw; Tue, 5 Jul 2022 06:29:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sEE8u4FkFfAApNnnVLhRoczkGfepGaibiJS7L4LVbQgicQ/IOPhXDZvpgnDk1o8AOws5YG X-Received: by 2002:a05:6a00:996:b0:505:b6d2:abc8 with SMTP id u22-20020a056a00099600b00505b6d2abc8mr41298659pfg.11.1657027769300; Tue, 05 Jul 2022 06:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657027769; cv=none; d=google.com; s=arc-20160816; b=wYgFO+z0naro24br1c9ya+WQnOPyVjCic5zRmpJO3m16p6Pcd3UydeWv0tpJdL8G4j D+/a+Fa2efO9W5arBmOd94wfbEYF53X8PkO+rX3NiWCvHt9v2UO7xU+xzApjrwA+FNVD eCyn76CiAXdrrdgNJWaWgz0knlP0aQ6wDJpP8m2Bb/Zk0JsFf6rvrcQHZsbw8qqMX2z4 LoqRWPcPCCTwKk38yZv9ciXxTDaygM4Xmn3L6WTXzbX9e2/Hi+xZ4lLpsd3lEbaxz8vd A1g/OWV39Y/hRd4YKKtOypBHJ3aw3dmtNHYFroBbaTPSMK5hMeYGI+bG1YBqUHuGAPyv FwRA== 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=DrVFvGyfRqKDm+oRuaZRl6lAkfVG3r9QicOOcEVSVbM=; b=Fgd9Tj/bIklbzsKFnJ5ZhmWZNqo7kiZdu0hmP93J1OV3TG/gTdsMzHY2TUzeDbw0D5 rH6xmGggp2aVx6K8GUQZWiMbxEkrVMYp/Rifo7flSXTh92/wHG5baSyS6+fjXjl3MKXF 8Txy4N739t8/ERgbNd23me3bfLAoy81+iC/HkOyTQaeTi1oHoUZCg8SC65I/ZqOe5oaE 9aofPcQTN+7sX46b/UILQ8+KJ8eWJwjCqQguZLeORU9slCUYXqyjRpzL2/CMWGPg5L+G xlajl/aeELrox0mlEfBWBLwE26sQMviun06JCEsBiPuLzTxMOf2+pCUMwjABybOxpYdK jrmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SO4jPhJc; 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.29.16; Tue, 05 Jul 2022 06:29:29 -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=SO4jPhJc; 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 S235437AbiGEMMY (ORCPT + 99 others); Tue, 5 Jul 2022 08:12:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234472AbiGEMHe (ORCPT ); Tue, 5 Jul 2022 08:07:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A5618E3A; Tue, 5 Jul 2022 05:06:31 -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 ams.source.kernel.org (Postfix) with ESMTPS id 89EC1B817C7; Tue, 5 Jul 2022 12:06:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01B63C341CB; Tue, 5 Jul 2022 12:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657022789; bh=erAfyOiIq47UiL83B/f1Y/WqCMoMo+YT8WLAClCV6Zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SO4jPhJcb8TllOEXg34v6nmHd9674dRHu1Naln+rXs7J7A7ezFjesx7Zjb9JA4Yt7 QfaXt49v2xosUvxL8h5JIM46H9GggrjnlCtoIyTtTOcK36uUa92Qbdvp1LFZ8FdfGH Vb0bFh2kW3jD+/hlbHx0O1q2yLD6cpKQERBhHtoE= 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 5.10 11/84] SUNRPC: Fix READ_PLUS crasher Date: Tue, 5 Jul 2022 13:57:34 +0200 Message-Id: <20220705115615.658418689@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115615.323395630@linuxfoundation.org> References: <20220705115615.323395630@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 @@ -752,7 +752,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;