Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp898688imu; Tue, 11 Dec 2018 09:14:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/VAloDVxV/AZJNVmI0q0D2j2i3JNF4Xbgg9FWnVxw91VZlffc18XLZDHvCNitw91nXR1GG+ X-Received: by 2002:a63:e80e:: with SMTP id s14mr15265147pgh.30.1544548493479; Tue, 11 Dec 2018 09:14:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544548493; cv=none; d=google.com; s=arc-20160816; b=J8QpiWPwH/9cqQ/aCWVQhVuXLLDLsHYQjO7NWpUcneNdSvlBeUiIONo0KvOVFgDIay jkv9ea4YnTGeleuq/6hgit3sdCAoalckQYZnyZefq5hBmjcU4MYX3Q6qvSkBDBbcaMDi DOftq15bwCwwso0Q+VHeow0/Gt9eGZgT3Iv18dXJ7LuSSv9kvjdxkc/9QiNemdbwE5yk RckNb1HoO+opitwIICb8J2dlzN+drqKWJb9iOqc9GqtgVOYvQIkI0z6nQ6Qqj/9OluPE JpHGlC0qWsajjcDMupUgAuw9piQ8g3uvvt7t7zKXcAQY92DlAZY3bZNlO0g/BoKwHhtX F3UA== 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=VvcFQBzIKk+0+d1z/Psg32GpUHEfOJv72uIhDlGkRyY=; b=rDMCQmhJh439TAAR51l+DmBGeaWpU/gP21dANNwg4RC07JoSCuDbgB+LMwzKIkZxSz mihPhSVm3DzC4iwpwxQCZT+Ij/boYXBuO8ZyrwK4IRQV3Hv5Z/mMb9Uq9RYMhxZKppi8 5RRtFCw0M6TBJ79VNqdo3qxgek2cABtCmr//01o8Scu+aS/35CEM3yvdfEqaplsWIuhg zqXhayERSMJag4CtG0jXAZLjCaCC883qic/LdA1rdYZAy7+qtbcwSNTbJjXAjQrGXUJQ wI0r9/6ZUmWMZLlbhbfqKeCz1uif9mW/oNGVdGU/S/zDozD5tbTWgktcmDP5WLkOhy3G uk8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oxjgMhww; 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 2si12524969pgy.35.2018.12.11.09.14.38; Tue, 11 Dec 2018 09:14:53 -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=oxjgMhww; 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 S1727857AbeLKPo2 (ORCPT + 99 others); Tue, 11 Dec 2018 10:44:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:32832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727202AbeLKPo1 (ORCPT ); Tue, 11 Dec 2018 10:44:27 -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 EFD212082F; Tue, 11 Dec 2018 15:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544543066; bh=l5I55SoVdCEfrF5WB+8PL+A/2gfzoQe4t8oXgd7bP6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxjgMhwwPdoO57lkAor3HL8jdbzuZkyF4fASFCoQyXM5c73B6JW6RnxfYH9qdh68I dOKzno0ks7WyOdN1/jHhgcg7RDUdzeselgYWx4E8AGkHPpMjJW8BgunMUOSqwsMxRW CgIyALXFa+EJUB+1AskjBXyr6MZfUxWauUYlFh7w= 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 3.18 47/54] SUNRPC: Fix leak of krb5p encode pages Date: Tue, 11 Dec 2018 16:41:35 +0100 Message-Id: <20181211151548.707496549@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181211151546.010073210@linuxfoundation.org> References: <20181211151546.010073210@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 3.18-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 @@ -1721,6 +1721,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 @@ -1729,6 +1730,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;