From patchwork Sat Sep 5 01:31:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 7126971 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DAB3A9F32B for ; Sat, 5 Sep 2015 01:37:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 10CC2208B4 for ; Sat, 5 Sep 2015 01:37:59 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4AA01208A2 for ; Sat, 5 Sep 2015 01:37:58 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3756A182ECA; Fri, 4 Sep 2015 18:37:58 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by ml01.01.org (Postfix) with ESMTP id 0ED91182E32 for ; Fri, 4 Sep 2015 18:37:57 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 04 Sep 2015 18:37:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,471,1437462000"; d="scan'208";a="555636961" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.137]) by FMSMGA003.fm.intel.com with ESMTP; 04 Sep 2015 18:37:41 -0700 Subject: [PATCH 08/11] ndctl: unreference dimm kmod_module during free_bus From: Dan Williams To: linux-nvdimm@lists.01.org Date: Fri, 04 Sep 2015 21:31:58 -0400 Message-ID: <20150905013158.28464.65681.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <20150905012538.28464.18136.stgit@dwillia2-desk3.amr.corp.intel.com> References: <20150905012538.28464.18136.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-8-g92dd MIME-Version: 1.0 Cc: Nicholas Moulin X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Moulin We were leaking memory every time a ndctl ctx was created and released due to the dimm kmodule not being released when the bus was free Signed-off-by: Nicholas Moulin Tested-by: Vishal Verma Signed-off-by: Dan Williams --- lib/libndctl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libndctl.c b/lib/libndctl.c index d85453a3ac63..5de7359f1cc5 100644 --- a/lib/libndctl.c +++ b/lib/libndctl.c @@ -584,6 +584,7 @@ static void free_bus(struct ndctl_bus *bus) list_del_from(&bus->dimms, &dimm->list); free(dimm->dimm_path); free(dimm->dimm_buf); + kmod_module_unref(dimm->module); free(dimm); } list_for_each_safe(&bus->regions, region, _r, list)