From patchwork Thu Mar 3 12:11:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 63478 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2923007lbc; Thu, 3 Mar 2016 04:40:13 -0800 (PST) X-Received: by 10.66.141.11 with SMTP id rk11mr3141322pab.75.1457007198402; Thu, 03 Mar 2016 04:13:18 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ke7si65296729pab.183.2016.03.03.04.13.18; Thu, 03 Mar 2016 04:13:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757496AbcCCMNP (ORCPT + 3 others); Thu, 3 Mar 2016 07:13:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:33484 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757233AbcCCMNJ (ORCPT ); Thu, 3 Mar 2016 07:13:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 2BE31ADC3; Thu, 3 Mar 2016 12:13:08 +0000 (UTC) From: Jiri Slaby To: stable@vger.kernel.org Cc: Suman Anna , "Michael S . Tsirkin" , Jiri Slaby Subject: [patch added to 3.12-stable] virtio: fix memory leak of virtio ida cache layers Date: Thu, 3 Mar 2016 13:11:39 +0100 Message-Id: <1457007150-3468-62-git-send-email-jslaby@suse.cz> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1457007150-3468-1-git-send-email-jslaby@suse.cz> References: <1457007150-3468-1-git-send-email-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Suman Anna This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. -- 2.7.2 -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html =============== commit c13f99b7e945dad5273a8b7ee230f4d1f22d3354 upstream. 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. Signed-off-by: Suman Anna Signed-off-by: Michael S. Tsirkin Signed-off-by: Jiri Slaby --- drivers/virtio/virtio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index ee59b74768d9..beaa7cc4e857 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -238,6 +238,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);