From patchwork Thu Sep 17 00:29:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suman Anna X-Patchwork-Id: 53771 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 9353F22A0D for ; Thu, 17 Sep 2015 00:29:39 +0000 (UTC) Received: by lagj9 with SMTP id j9sf770270lag.0 for ; Wed, 16 Sep 2015 17:29:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=qTVjrlvhxVu0jb/c0doGSy7E7sI9ZStcaS4XcrqjoqQ=; b=DuBd2Cdh+W0z9D3Dc+zBpR/+WKlmoCwuCHmQvPT2M40Ap3jMANnmyMsG76jki5qbDB Oa+nVSkPG6mrhcBmK1yr50LJvdMnMBP3TkjfCy6ZG0m8fkl/PB0z3pI8VbQWf7jW64SI Jdj1zu+SaWHhD9+VIMsFQlP20rb8ahsu4MwloOX8duB/nFO5MW17sHicaYYEoTJRfsqe IquGBxWhrjS0eUHm0cJXDI48kHpqbWQx8/nlpZ7bVCFGrPQIIA4h5TIv/MZ/HLdua2Pb CslteJJnK+D62AHEF15CIIg3e9fKFZcmdfylARqtyAEj3Xscaqk1mV8CUgXzkTi0ri19 L09w== X-Gm-Message-State: ALoCoQmwEYc75v+nThOH7qBKqV7GshVdeWbKBwU4QaGjOupYIu+g29uhzVjidnL3FB3UtDSNtOrQ X-Received: by 10.152.163.97 with SMTP id yh1mr778097lab.10.1442449778545; Wed, 16 Sep 2015 17:29:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.45.100 with SMTP id l4ls14511lam.80.gmail; Wed, 16 Sep 2015 17:29:38 -0700 (PDT) X-Received: by 10.112.147.135 with SMTP id tk7mr33235552lbb.100.1442449778358; Wed, 16 Sep 2015 17:29:38 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id u10si404060lau.30.2015.09.16.17.29.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Sep 2015 17:29:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lanb10 with SMTP id b10so1449106lan.3 for ; Wed, 16 Sep 2015 17:29:38 -0700 (PDT) X-Received: by 10.112.51.142 with SMTP id k14mr30582111lbo.76.1442449778139; Wed, 16 Sep 2015 17:29:38 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp2766346lbq; Wed, 16 Sep 2015 17:29:37 -0700 (PDT) X-Received: by 10.50.108.104 with SMTP id hj8mr8880716igb.54.1442449776391; Wed, 16 Sep 2015 17:29:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id df2si982176pad.18.2015.09.16.17.29.36; Wed, 16 Sep 2015 17:29:36 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753280AbbIQA32 (ORCPT + 29 others); Wed, 16 Sep 2015 20:29:28 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42310 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbbIQA3Z (ORCPT ); Wed, 16 Sep 2015 20:29:25 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id t8H0TKT3004625; Wed, 16 Sep 2015 19:29:20 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8H0TK1K023122; Wed, 16 Sep 2015 19:29:20 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.224.2; Wed, 16 Sep 2015 19:29:21 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id t8H0TKlT009686; Wed, 16 Sep 2015 19:29:20 -0500 Received: from localhost (irmo.am.dhcp.ti.com [128.247.9.166]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id t8H0TK923782; Wed, 16 Sep 2015 19:29:20 -0500 (CDT) From: Suman Anna To: Ohad Ben-Cohen , "Michael S. Tsirkin" CC: , , Suman Anna Subject: [PATCH 1/2] virtio: fix memory leak of virtio ida cache layers Date: Wed, 16 Sep 2015 19:29:17 -0500 Message-ID: <1442449758-14594-2-git-send-email-s-anna@ti.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1442449758-14594-1-git-send-email-s-anna@ti.com> References: <1442449758-14594-1-git-send-email-s-anna@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: s-anna@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The virtio core uses a static ida named virtio_index_ida for assigning index numbers to virtio devices during registration. The ida core may allocate some internal idr cache layers and an ida bitmap upon any ida allocation, and all these layers are truely freed only upon the ida destruction. The virtio_index_ida is not destroyed at present, leading to a memory leak when using the virtio core as a module and atleast one virtio device is registered and unregistered. Fix this by invoking ida_destroy() in the virtio core module exit. Cc: "Michael S. Tsirkin" Signed-off-by: Suman Anna --- drivers/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index b1877d73fa56..7062bb0975a5 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -412,6 +412,7 @@ static int virtio_init(void) static void __exit virtio_exit(void) { bus_unregister(&virtio_bus); + ida_destroy(&virtio_index_ida); } core_initcall(virtio_init); module_exit(virtio_exit);