From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 49A8FC433F5 for ; Sun, 23 Jan 2022 00:12:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id DB1624033F; Sun, 23 Jan 2022 00:12:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nrndkmWO9zry; Sun, 23 Jan 2022 00:12:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2658540104; Sun, 23 Jan 2022 00:12:11 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E3047C0073; Sun, 23 Jan 2022 00:12:10 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id C9F08C002F for ; Sun, 23 Jan 2022 00:12:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B808F60ADA for ; Sun, 23 Jan 2022 00:12:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n_dLKaCgJTuh for ; Sun, 23 Jan 2022 00:12:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by smtp3.osuosl.org (Postfix) with ESMTPS id 0068D605E9 for ; Sun, 23 Jan 2022 00:12:07 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B97260F9B; Sun, 23 Jan 2022 00:12:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC00CC004E1; Sun, 23 Jan 2022 00:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642896726; bh=94AMPHSOMB0HPZgdjyDj+IRBX/Gt+wzDLbqEMbirc/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwrJd8KLZSnIzRgkjXd3GfgjzYubVes9RhCi6gigpRvb1LR/hVt9yvC75/+XyckEN NWebGCH6zlNmGKaDw2o8hudWR9bLdb3UxTYWqA7LY31jOOTY6UlY5SATD8E4TtcP2V +1lE6lJn9yiq25ZrULC9ioTQr4crNLjcGCZbxqvuE74fy9ukkHtYTguMFITYpMkVoJ KfDHK+hGOYaabQwNq6DDF2tAO9XwbS23kHYK900edcmUOET2LFUTa42hQOwWhzMFBw XnZcAVCrE0/XR1s5YUS60V5T4dpjbrIvU3dtttwTJHPyOFi+xen7hjbi5TN+wr8Klk pWn4rWrF2Ja9w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 15/19] vhost/test: fix memory leak of vhost virtqueues Date: Sat, 22 Jan 2022 19:11:08 -0500 Message-Id: <20220123001113.2460140-15-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220123001113.2460140-1-sashal@kernel.org> References: <20220123001113.2460140-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Cc: Sasha Levin , kvm@vger.kernel.org, "Michael S . Tsirkin" , Xianting Tian , netdev@vger.kernel.org, virtualization@lists.linux-foundation.org X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" From: Xianting Tian [ Upstream commit 080063920777af65105e5953e2851e036376e3ea ] We need free the vqs in .release(), which are allocated in .open(). Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20211228030924.3468439-1-xianting.tian@linux.alibaba.com Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Sasha Levin --- drivers/vhost/test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index a09dedc79f682..05740cba1cd89 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -166,6 +166,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) /* We do an extra flush before freeing memory, * since jobs can re-queue themselves. */ vhost_test_flush(n); + kfree(n->dev.vqs); kfree(n); return 0; } -- 2.34.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13C21C433EF for ; Sun, 23 Jan 2022 00:13:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235717AbiAWANx (ORCPT ); Sat, 22 Jan 2022 19:13:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235509AbiAWANH (ORCPT ); Sat, 22 Jan 2022 19:13:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59A7C061763; Sat, 22 Jan 2022 16:12:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 62F1660F9F; Sun, 23 Jan 2022 00:12:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC00CC004E1; Sun, 23 Jan 2022 00:12:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642896726; bh=94AMPHSOMB0HPZgdjyDj+IRBX/Gt+wzDLbqEMbirc/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwrJd8KLZSnIzRgkjXd3GfgjzYubVes9RhCi6gigpRvb1LR/hVt9yvC75/+XyckEN NWebGCH6zlNmGKaDw2o8hudWR9bLdb3UxTYWqA7LY31jOOTY6UlY5SATD8E4TtcP2V +1lE6lJn9yiq25ZrULC9ioTQr4crNLjcGCZbxqvuE74fy9ukkHtYTguMFITYpMkVoJ KfDHK+hGOYaabQwNq6DDF2tAO9XwbS23kHYK900edcmUOET2LFUTa42hQOwWhzMFBw XnZcAVCrE0/XR1s5YUS60V5T4dpjbrIvU3dtttwTJHPyOFi+xen7hjbi5TN+wr8Klk pWn4rWrF2Ja9w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xianting Tian , "Michael S . Tsirkin" , Jason Wang , Sasha Levin , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.16 15/19] vhost/test: fix memory leak of vhost virtqueues Date: Sat, 22 Jan 2022 19:11:08 -0500 Message-Id: <20220123001113.2460140-15-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220123001113.2460140-1-sashal@kernel.org> References: <20220123001113.2460140-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Xianting Tian [ Upstream commit 080063920777af65105e5953e2851e036376e3ea ] We need free the vqs in .release(), which are allocated in .open(). Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20211228030924.3468439-1-xianting.tian@linux.alibaba.com Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Sasha Levin --- drivers/vhost/test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index a09dedc79f682..05740cba1cd89 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c @@ -166,6 +166,7 @@ static int vhost_test_release(struct inode *inode, struct file *f) /* We do an extra flush before freeing memory, * since jobs can re-queue themselves. */ vhost_test_flush(n); + kfree(n->dev.vqs); kfree(n); return 0; } -- 2.34.1