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 5EDCDC433EF for ; Tue, 14 Jun 2022 02:07:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E59AA4061C; Tue, 14 Jun 2022 02:07:58 +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 4BoM1EZmUfTr; Tue, 14 Jun 2022 02:07:58 +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 9282040484; Tue, 14 Jun 2022 02:07:57 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6800EC0039; Tue, 14 Jun 2022 02:07:57 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id B7526C002D for ; Tue, 14 Jun 2022 02:07:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 9099B41677 for ; Tue, 14 Jun 2022 02:07:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F-t6LZ8OZPjn for ; Tue, 14 Jun 2022 02:07:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by smtp4.osuosl.org (Postfix) with ESMTPS id D426441675 for ; Tue, 14 Jun 2022 02:07:55 +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 2A8E560EF6; Tue, 14 Jun 2022 02:07:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3270FC3411B; Tue, 14 Jun 2022 02:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655172475; bh=EN2LSdwrHyUj4sryCNoBl23CVmDro7Q1flq5/ck1sI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9bWRu+tjq+CKTgiqAbaW81IzZGFbNB+xkqSGb5W67V0R8gpeo4P0pb5lOsUaXrW1 i/S8BNmC80nRB+Quo9a+gwMJ+F4GjYXfliGsm1teZ01zb+typGXl/LYIpqlJ4eqYmf YvYV/cROjhpQ5YFeKU4MlYVEBFyDAdaXlq/P3pBfC8PVWQ+qyu+7vb4ex9NYj1DrFE z2vukniWMkQ4eft95lPpj2rK9CakMT913vNsKYzLF9MX0ifTCU4FPm+W5RGDuAgfVu b5GILzrt4vYXWWoQvku2OD+c5Tkb9G1o3Ot2T0Z0Ac0gXGLHxu3qk7S8zk5Wtd28dZ EQAJ2S+rguYDA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 28/41] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed Date: Mon, 13 Jun 2022 22:06:53 -0400 Message-Id: <20220614020707.1099487-28-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220614020707.1099487-1-sashal@kernel.org> References: <20220614020707.1099487-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Cc: Sasha Levin , virtualization@lists.linux-foundation.org, chengkaitao , "Michael S . Tsirkin" 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: chengkaitao [ Upstream commit a58a7f97ba11391d2d0d408e0b24f38d86ae748e ] The reference must be released when device_register(&vm_cmdline_parent) failed. Add the corresponding 'put_device()' in the error handling path. Signed-off-by: chengkaitao Message-Id: <20220602005542.16489-1-chengkaitao@didiglobal.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Sasha Levin --- drivers/virtio/virtio_mmio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 56128b9c46eb..1dd396d4bebb 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -688,6 +688,7 @@ static int vm_cmdline_set(const char *device, if (!vm_cmdline_parent_registered) { err = device_register(&vm_cmdline_parent); if (err) { + put_device(&vm_cmdline_parent); pr_err("Failed to register parent device!\n"); return err; } -- 2.35.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization