Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2720270ybi; Sun, 9 Jun 2019 19:18:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1GXOcn9PlTbSqx0BaTrUJnup9dIzl5Z7xo4nTzqrM+WbSaQBnm7mjKN4jXGQqoYfu+ZpL X-Received: by 2002:a62:8c81:: with SMTP id m123mr13493491pfd.240.1560133117003; Sun, 09 Jun 2019 19:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560133116; cv=none; d=google.com; s=arc-20160816; b=Q0tB0V3T82pE339dcduuZ+3rO6KBj9zymM3iMsF4D644lKIjmxL14boo0sOSDuOBrY LniD69eQAhU9UyLE+3AdHJ45+skUpLJN4SqHCfZH1+aEJaxPSVt+5qTI+B4BgIpDqx+e tMRrDOls+cmOhowOjnKpO81txv7eZ32t6SryVzfra4xbC90LKl0SpTJbZtB+Y0zZ4axj 0wEWrjgXyHCzznSwPvjBnmgqCfsCmksKHFoK6vacxR3tuIktMtghc6F/XmO6ZbBckDT4 JyBQ9sREdzWaMkiJXEsTstgEBdvngEMkCq9BsYsQrzqJ/RIlnxIYXC1zWlZu0hnjvVS+ wqsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature; bh=VtNxhqgNuhAXI6wf7or1jR1mdLlxPT12xbJh+4Ao0m8=; b=ASz6pwe1bUhZE2rWKcuCxH0QtYi9Wzx/lt/t0gJ9vWGbaF+HjsEpn7fhq7hGAGBR85 KAVwtjLDYsYQS1AzdrOkST0+ZhB0Tnri8qlNlOk6CCs3cAo78nw9Zrkup1UKsuRrnaFa /9XEUfNY++alJH/YJcZCDMfN04xclKBkWu9VB7rLlx8+PThprFz8uFTb9c+lF/o1rdqb CYjJ274KVXlytUs+7zxEYqqZKEfM9EnDJvZdEgLnsCy1h1DcfVSyLyc/aE6MC3+qI06F BIOt6DaQDdxYW5nqrkl1O/gYwdCmaMYBr4Jar6WdvkPvsIcw3YEDfD2R5nS8o/RHBnJK i/Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=a+fz0lgy; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l23si8633451pff.2.2019.06.09.19.18.06; Sun, 09 Jun 2019 19:18:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@163.com header.s=s110527 header.b=a+fz0lgy; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730107AbfFJCRM (ORCPT + 99 others); Sun, 9 Jun 2019 22:17:12 -0400 Received: from m12-15.163.com ([220.181.12.15]:42115 "EHLO m12-15.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729916AbfFJCRM (ORCPT ); Sun, 9 Jun 2019 22:17:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Message-ID:MIME-Version; bh=VtNxh qgNuhAXI6wf7or1jR1mdLlxPT12xbJh+4Ao0m8=; b=a+fz0lgy0D+3fhqCxAbLQ dTwhQzJHxeGPmLzoh2JJJWZ4pmSDEgoH9YHe4HZcVPmOukEZ/WGSHe9Anl+QcnPk jYOTMfDa9F+cNVmy7ycrMdAwwo7BGb1xmCupMVp3+VDiDoCgqhtP4QUihwcVC5gK 4SpYljXk/FjeDjNj3hhO84= Received: from tero-machine (unknown [124.16.85.90]) by smtp11 (Coremail) with SMTP id D8CowABnZ2WYvf1catboAg--.21215S3; Mon, 10 Jun 2019 10:16:56 +0800 (CST) Date: Mon, 10 Jun 2019 10:16:56 +0800 From: Lin Yi To: trond.myklebust@hammerspace.com, anna.schumaker@netapp.com Cc: linux-nfs@vger.kernel.org, liujian6@iie.ac.cn, csong@cs.ucr.edu, zhiyunq@cs.ucr.edu, yiqiuping@gmail.com, teroincn@163.com Subject: [PATCH] net :sunrpc :clnt :Fix xps refcount imbalance on the error path Message-ID: <20190610021655.GA14779@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-CM-TRANSID: D8CowABnZ2WYvf1catboAg--.21215S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrAFykuw13uw1rJry7Ww17Jrb_yoWxGwc_Xw 1xXrWxXw4DGanrtFZrAws5CrW7tr40kry8WrnFyrZrXw1UZ3Wjvr93W3Z3Gay7GrWxuasx Ar98G345Cw15tjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IU1RpBDUUUUU== X-Originating-IP: [124.16.85.90] X-CM-SenderInfo: 5whu0xxqfqqiywtou0bp/1tbiLxLPElUMNRFJRwAAsT Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 --- net/sunrpc/clnt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 627a87a..2b35347 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2805,6 +2805,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; -- 1.9.1