Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp9937018ybi; Wed, 24 Jul 2019 12:39:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqycuEBv8HhNv1Jus/QRM5J2b6vLqgkgMylWEOnwS9iWOdHWz0DtqhixjboaY5a7WHxmGhsG X-Received: by 2002:a17:90a:db44:: with SMTP id u4mr89036977pjx.52.1563997154008; Wed, 24 Jul 2019 12:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563997154; cv=none; d=google.com; s=arc-20160816; b=wIKneNRv+OSobNf5XrKXSJtwr6QRfBD6dRVgoXPS9ln1VpmEd4DrnnmCrwOjj5DcW+ 8PSIptaceyv4MFd0m9F2I2vDnvXAt1YpGFRY7wAWBgaf+C71VuxGAhRE4ibAq32Noam0 /a+dE7agrLLZr0Qrufprdx4aZtCJ6T7HN3VIF1+FBaCExQrAiFKSMqt2AIWDhowymV47 0qptLTesTe8WfXh+sp785WSLMMxBBEFP6xb5gUgxPRPoPeE1rNPeGnhtIXJKVQ7sPfos naoDdHlynzf6pS8bPPy+FktdO9oMpSX9JtiG5V79dHK3vsID6uvrp4Joh11LGVf0K1Cp o/+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sjqM1qC+AhRW8pMrAZRvVQwQEeu3f4qh0vuNMIx3Khw=; b=gP01ZDYoe+sbISWrjZ3mAcNssPDFoOXbinf4s7TsOaqCCvi1RrN8CDjdZn/ucFK7FE 6a9QcBZNNXIu2tNSPpT7qx8I5f/p7NFWActSLMcRUeSdxpoPfSFxg6ER0NjmFzj8mjKF QJRogafZP5k5fq3GiX1ECckEUk5JcP0pad3l3u63lvI02FxO1YncTg5ao6IqTS4eL7A4 /zW+tRLjDQdfaUu3fTJqborkKnkemaq9/ZTV5FaFwfc9sPy/LLpk5/yoJ3ljpmrNL8Qy VHnDrvof4yTveeJi49lXs3gpQZBoQRWwSCkKs+T7N2vNyzKAAD5hp8RMdLf6fhqXxPAz U57g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="HgfGfvH/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c18si16708561pjo.105.2019.07.24.12.38.59; Wed, 24 Jul 2019 12:39:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="HgfGfvH/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389510AbfGXThn (ORCPT + 99 others); Wed, 24 Jul 2019 15:37:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:37922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389508AbfGXThk (ORCPT ); Wed, 24 Jul 2019 15:37:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 36AC920665; Wed, 24 Jul 2019 19:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997059; bh=kkdb9rpIpqLfoQlsjJfFqsf8rrboPnAdP2Hxt735zmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HgfGfvH/rLN2tnre85Cv93LOKbGP0bluzQBS5E76/jU6fDVJmQegCVzuJxuicva+f eQKq26GThp8wfHlY9HZ/k7JJZncLTk4J4VnsNuOoDW2P6O9z6xMDQNM0625daRcGD+ DEj1+RxWTrWenLcpU61UyXWjlANM7PhAnxxlHYHs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.2 308/413] SUNRPC: Ensure the bvecs are reset when we re-encode the RPC request Date: Wed, 24 Jul 2019 21:19:59 +0200 Message-Id: <20190724191757.796535775@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191735.096702571@linuxfoundation.org> References: <20190724191735.096702571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust commit 75369089820473eac45e9ddd970081901a373c08 upstream. The bvec tracks the list of pages, so if the number of pages changes due to a re-encode, we need to reset the bvec as well. Fixes: 277e4ab7d530 ("SUNRPC: Simplify TCP receive code by switching...") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.20+ Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/clnt.c | 3 +-- net/sunrpc/xprt.c | 2 ++ net/sunrpc/xprtsock.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -1788,6 +1788,7 @@ rpc_xdr_encode(struct rpc_task *task) req->rq_snd_buf.head[0].iov_len = 0; xdr_init_encode(&xdr, &req->rq_snd_buf, req->rq_snd_buf.head[0].iov_base, req); + xdr_free_bvec(&req->rq_snd_buf); if (rpc_encode_header(task, &xdr)) return; @@ -1827,8 +1828,6 @@ call_encode(struct rpc_task *task) rpc_call_rpcerror(task, task->tk_status); } return; - } else { - xprt_request_prepare(task->tk_rqstp); } /* Add task to reply queue before transmission to avoid races */ --- a/net/sunrpc/xprt.c +++ b/net/sunrpc/xprt.c @@ -1013,6 +1013,8 @@ xprt_request_enqueue_receive(struct rpc_ if (!xprt_request_need_enqueue_receive(task, req)) return; + + xprt_request_prepare(task->tk_rqstp); spin_lock(&xprt->queue_lock); /* Update the softirq receive buffer */ --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -909,6 +909,7 @@ static int xs_nospace(struct rpc_rqst *r static void xs_stream_prepare_request(struct rpc_rqst *req) { + xdr_free_bvec(&req->rq_rcv_buf); req->rq_task->tk_status = xdr_alloc_bvec(&req->rq_rcv_buf, GFP_KERNEL); }