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 C4D35CCA47B for ; Tue, 14 Jun 2022 02:06:49 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 71E49403D6; Tue, 14 Jun 2022 02:06:49 +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 Pn9IOyuwJOoX; Tue, 14 Jun 2022 02:06:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTPS id 2B91240484; Tue, 14 Jun 2022 02:06:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 05F61C0039; Tue, 14 Jun 2022 02:06:48 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 98F5BC002D for ; Tue, 14 Jun 2022 02:06:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7A2CC4158B for ; Tue, 14 Jun 2022 02:06:46 +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 HbMFLPpkmAAT for ; Tue, 14 Jun 2022 02:06:45 +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 C1B5741675 for ; Tue, 14 Jun 2022 02:06:45 +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 70C4C60DBB; Tue, 14 Jun 2022 02:06:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EB32C3411E; Tue, 14 Jun 2022 02:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655172404; bh=EN2LSdwrHyUj4sryCNoBl23CVmDro7Q1flq5/ck1sI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qXCa+HSGs1vud3/FanQQFn17xTKreolJKbry2G0ZAH+KOeCFH40KquCTHOfaVMHV1 k7u7BOZMkkSFAXR+DrV41axsVFjthOtvFQss1v/huPuwYIBJWg1J2DBf0jzBfsfPwi orR2HNJx2Lz4UgDCXJPLr92+eBrhwdXykmnYedYoiVtkTw8I8wIDD7D3V2UEmMZIHP WLQLBT4uqO2zFTG+FDrdxNmU3T0VSk0GSNzh/xrdPjac7z3l3rkaJqNnMUFR1mupXX IKTxDV6LtjkKt6FOwAtXgqSsRZT7QAyExBgntwHv2w1Gzph1QZCVKV+djD06sTAAB5 fFIZrMO6glIIg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 5.17 28/43] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed Date: Mon, 13 Jun 2022 22:05:47 -0400 Message-Id: <20220614020602.1098943-28-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220614020602.1098943-1-sashal@kernel.org> References: <20220614020602.1098943-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