Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp836532imu; Tue, 11 Dec 2018 08:18:00 -0800 (PST) X-Google-Smtp-Source: AFSGD/WMbUWJnA6eoCIEF9Glbl3g9BlshL11SY7Iw/lFvekkeQrMem5Kje83a/rVJ7Ocd5JxHbMs X-Received: by 2002:a63:f444:: with SMTP id p4mr14960229pgk.124.1544545080872; Tue, 11 Dec 2018 08:18:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544545080; cv=none; d=google.com; s=arc-20160816; b=F6oUmDf1Um9zxmBaNhXjpQ0mzjLYTpP+AOv8Mtn3KdkSMQWYagTZ4CTBXe84JALp8I orebhhBrfRqhJt3OZnVhwD/IkEUFnnAwWnfO6YrwFhm0xdBZ7fJk0KfalNwmKJ1aRxFG pee54gbvqpYm8CUOaCTtAFgbKya4PYSfJJMmSGPDMy3V/WbXIUnvuzAhYAgFgLv5Y3G0 EeAog3VZCHKYNXEozhjwUq8miN1cvoQPf/+0UvB8LY9wr1AnXxFs9pLb2v71MzyoXe8I E+p2gMAf//UHdMP/10ubwpfY921Y822fDzPFbqGmmiNRf370xI1Wr7vXTrCkEi+bi50k xrxw== 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=7EIPfl98ehTqRuFAvBLGruc302K/KT8e4M8VxpTtoE0=; b=R6KwtXIdy2ctGm28fwrB5M3iq2Z6bWHyB3m//MecjKT3fqLzd/Nu+W9r3XYCQrePus T6PrK5XV6EqEzmBRZVI8ZBdkSkAZZw/y9sdRrTa3TgSPLjLHS4aSftqm+RPm6N9x05bZ SCpJqvlx0f3ipi7rq2JpC07I9UZfd+Eqy0pQD4PWbqbg/jJtTJRvzY+vWf6oCTgrH9Ta lo/lVx7GP/xgkP6hcsaoXSgjIuWcwHdWi/k4q/q2eI2MMzkoeFNTggfdy7Js05UitBtG lbusNdc+iQoPpgaZ9k98z0wn+RbJ8EcCb3u1WeqMc8WgYOu6kej/esRaLwap8BKeWe1w a0pQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HJS0zLKU; 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 s4si13177692pfb.190.2018.12.11.08.17.46; Tue, 11 Dec 2018 08:18:00 -0800 (PST) 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=HJS0zLKU; 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 S1728724AbeLKPsF (ORCPT + 99 others); Tue, 11 Dec 2018 10:48:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:36392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728213AbeLKPsA (ORCPT ); Tue, 11 Dec 2018 10:48:00 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 7FA202133F; Tue, 11 Dec 2018 15:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543280; bh=Rm621VhDW06bR0fyDrPcGFwDsO1Zjq9+ee0uMsx2R9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HJS0zLKUdvc7WvMOf6VEJzIrCxc7mYOLi1gwItft8IxZjI74GjB10ECCgiPItaWan bzNxqx47sWjaWjuZxMNm3QTqCGN3fQH+KLS/PQJfcGmisYCmGyWQKWXeeCTBK4zVkF OBECmNJoTx6nX7wq3naxzmUMxgn+r6yx2FB12k7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever , stable@kernel.org, Trond Myklebust Subject: [PATCH 4.4 80/91] SUNRPC: Fix leak of krb5p encode pages Date: Tue, 11 Dec 2018 16:41:39 +0100 Message-Id: <20181211151613.183132224@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151606.026852373@linuxfoundation.org> References: <20181211151606.026852373@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chuck Lever commit 8dae5398ab1ac107b1517e8195ed043d5f422bd0 upstream. call_encode can be invoked more than once per RPC call. Ensure that each call to gss_wrap_req_priv does not overwrite pointers to previously allocated memory. Signed-off-by: Chuck Lever Cc: stable@kernel.org Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman --- net/sunrpc/auth_gss/auth_gss.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c @@ -1722,6 +1722,7 @@ priv_release_snd_buf(struct rpc_rqst *rq for (i=0; i < rqstp->rq_enc_pages_num; i++) __free_page(rqstp->rq_enc_pages[i]); kfree(rqstp->rq_enc_pages); + rqstp->rq_release_snd_buf = NULL; } static int @@ -1730,6 +1731,9 @@ alloc_enc_pages(struct rpc_rqst *rqstp) struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; int first, last, i; + if (rqstp->rq_release_snd_buf) + rqstp->rq_release_snd_buf(rqstp); + if (snd_buf->page_len == 0) { rqstp->rq_enc_pages_num = 0; return 0;