Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1250868imw; Tue, 5 Jul 2022 06:26:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uQyhgqpwVuWwVeOfx3tYYxCteEEpW8jvhINr1mWELTxU8vV+xbk4FITKDFsyiRAZaPepeq X-Received: by 2002:a05:6402:11cd:b0:439:5cd:1ab7 with SMTP id j13-20020a05640211cd00b0043905cd1ab7mr39895195edw.394.1657027601506; Tue, 05 Jul 2022 06:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657027601; cv=none; d=google.com; s=arc-20160816; b=BEiekgZasKdKo2Az5jdLVG1ViWn8Wj4Dlh6Px49rpRSzFgRGSnM3IMIHEJmYF9TEIa 38Q8x5MXFCtm9305Zdcr3lGj8XPnMo8OkkrYRtuFcRVYrVJti9LaChvys5l6hsGldfkv X4k9XreFy+JHQVmYOs+HyGCrgP8uIhuOGMCdD2u7Iwj4iZkTpVnv1VQdmtitZwApbI5Q q1d233PQCFz4ceSy3FY3aOlNWY7BBri1ooWDNfg4bmF8PGty7Zq+OABtIZy9Q1X+ZGAG 1n2nIcw/iVsZyzmhu2nVrbYZRfBDa+TyLl1evIlx8Dd7ELzesAk0U6XO0lR0tr+CNWeY fGuw== 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=udOF554IUH9RNVilsVv7e33i504IJIJtQAfPg29ZmgbaiI0q6X10F8ohHKdPmgRgE1 G01B/NheYhJIN7JE/u0hY19RVcwTT27ddVBTKsItoPpTtfDY8Jx6xZS7HWxh0Sdsf6LJ Yd9Gp2EC5RAXPy+S/2fXaSCp4MEETAvbnv1dYXQmGZlWIh2Q8B35I/Xp2bVE5GbsEY/D C+8JXZ2/GoWjHkCdPIlJR39RAwMGI6l8i9HD50Pt0icGak8sjc7lgXGWCgOOuoMj5IIQ NyOesp0qu+LeV2MSH5SzBj/6IZ7wdSUHYy066t+EBCySlH/12GW+4tC9f0uKjH6YX9bP vkZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZtOJqFpo; 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 cw14-20020a170906478e00b0070f509be43csi13666839ejc.874.2022.07.05.06.26.15; Tue, 05 Jul 2022 06:26:41 -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=ZtOJqFpo; 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 S232732AbiGEMAJ (ORCPT + 99 others); Tue, 5 Jul 2022 08:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232700AbiGEMAE (ORCPT ); Tue, 5 Jul 2022 08:00:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC5517E1B; Tue, 5 Jul 2022 04:59:53 -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 0CD96617B1; Tue, 5 Jul 2022 11:59:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19755C341C7; Tue, 5 Jul 2022 11:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657022392; bh=edsKe0FVOvsRAYwbS5XjA2Hdnp3PFY86vrBZUlfMG/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZtOJqFpoR3naKG3/umhGm7DDnU+GUiDE8pN2OmSRwjv1jGpKPgDKAfiO9TlgSbzo4 p4Od0PGzEI+Uu8+hdQPxx6Bw2owtyMq9GrM+9oq+Fcy34fJNSwmndDeIeNhuSnXmwI kZLTVe8Xjq2panhlbLRombNA1XX7qNZ+KYADTok8= 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.9 02/29] SUNRPC: Fix READ_PLUS crasher Date: Tue, 5 Jul 2022 13:57:43 +0200 Message-Id: <20220705115605.816369937@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220705115605.742248854@linuxfoundation.org> References: <20220705115605.742248854@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;