Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp832498ybi; Fri, 12 Jul 2019 05:24:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7Ch7u1gGnZf9h2C+URbP3zWZF20TCH/xeGlKUh0WqgXYKnOFviSrSQUX6yJ4H+83eEm1e X-Received: by 2002:a63:da52:: with SMTP id l18mr10626673pgj.131.1562934241790; Fri, 12 Jul 2019 05:24:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934241; cv=none; d=google.com; s=arc-20160816; b=jwX7vvohqtTfg4FlqK/rCfTU7RJb2RhVxA93rI3oDXdyiIcy1qpoZTKSjR05Y2EDFN BXCoV1Kythofz/jgJkVtsSYNcwpBx4fXyBFFyZxQktRqlIxEjijdjmJ8yR80cGPtu78P dEbPtr5V1ELvHphoRl4rCmIF32tuP7FVvrB54p+PPSNRxwZv1MhiS9lq4AFxCyVhZGEr /Bil+mZwrEcDbggSI0m6aKmym+feP7zC/ysGtNcppdoJaAY8tO4/Z49+0DXlKAos7gPe 6cV1Mh5BPt0pdbQCdYCSDQ+U7hNg1DhEYe2tpf3FEXmkMnTmkE9VC71woJZchIq2gK1i FVGA== 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=XaEVVbjwHwa1gZRQ67LR/M5G6Jg3bLtz6S7E+6BAGx4=; b=AdmcvpUZKK5Zg1UapRSSne2NKRQ0Pr++Y/xMtfz/DkyNNUzQ82TspCZ8vGl/DzuZ8g st7e2kOzt+/jXl/ELilyBRBkNWrFuSBuyhs50+6Hcgw8gZZIJLhkw97UVFOmT7mE5qYs YaE8duOrG/XYlFdkWN/hYDj0/yx6wbyhfEWu35LLfdxX34EmXAGEpb19bBzvgXwRM7Nn Du9o+ut+cGJsiupRSOH/yS+mOE39Y1Xk0VTrJ+Mi9dvVSNqSrxqCHJQayYbxdEL+LZKv adSEk+wF6rMFWlJyQQO4+88N4Me8AKDjIJjDkxQuxK59S/nnO0DPFDneXshYGaNCntH3 YA9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YfTd4zOY; 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 31si7939128plc.356.2019.07.12.05.23.46; Fri, 12 Jul 2019 05:24:01 -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=YfTd4zOY; 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 S1727754AbfGLMWi (ORCPT + 99 others); Fri, 12 Jul 2019 08:22:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:57472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727740AbfGLMWh (ORCPT ); Fri, 12 Jul 2019 08:22:37 -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 7C648208E4; Fri, 12 Jul 2019 12:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934157; bh=X9WQ/ktOz+HBaUxvZSp95khvRqJtVx22HGawG6wBIB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YfTd4zOYDo3bEdb6wHv0HYXku/u28J4+aSbC7Orxplob9LkkcI99JoPyEVS9tM1cM YFtFvVRqqQNkh7NJZGDlel6q647oSAJs+M5JcYl05zGSggv90mdGmTztGJGK/PVb1A dnby0Oy10VQZuzm2frWj4A84lNQjGKbRoFDkFaZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yi , Anna Schumaker , Sasha Levin Subject: [PATCH 4.19 55/91] net :sunrpc :clnt :Fix xps refcount imbalance on the error path Date: Fri, 12 Jul 2019 14:18:58 +0200 Message-Id: <20190712121624.649755174@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121621.422224300@linuxfoundation.org> References: <20190712121621.422224300@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 [ Upstream commit b96226148491505318228ac52624956bd98f9e0c ] rpc_clnt_add_xprt take a reference to struct rpc_xprt_switch, but forget to release it before return, may lead to a memory leak. Signed-off-by: Lin Yi Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- net/sunrpc/clnt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 7e4553dbc3c7..0d7d149b1b1b 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2713,6 +2713,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, xprt = xprt_iter_xprt(&clnt->cl_xpi); if (xps == NULL || xprt == NULL) { rcu_read_unlock(); + xprt_switch_put(xps); return -EAGAIN; } resvport = xprt->resvport; -- 2.20.1