Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6114458iog; Thu, 23 Jun 2022 11:37:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sW+GWSdEWwVV1bR+7c9OamKaGdUNy/RiNeeTqQ2nJRmIGTpzq3KrzCRC7Ch5bsOTJbmnoS X-Received: by 2002:a63:68c7:0:b0:405:1da9:ab69 with SMTP id d190-20020a6368c7000000b004051da9ab69mr8805566pgc.233.1656009454370; Thu, 23 Jun 2022 11:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656009454; cv=none; d=google.com; s=arc-20160816; b=KTcLjtj6US/1cPayZHypLxcWbkugbD6+NFsQ439sLXtVUo5OgHyB30s4SLGEjaHFNT x17eqM12YUuOeR+C6qK1kd4Ayg2AV09womknLoGXtY/noaBhzKyTb/WrkcWWkIO+9cCB QnaauOhw1I2RvxUJZEsWADfAj5AtNgiCzNmTWZAWOiq8PBJ+TBS/clAfPfVlapfIF7cm tf2s1MkhzO9MxrnUQ1Yc8eARcLkUyNNBQiPDGqLdtIxDFrPL57SHzZKB2sMoev2LXX40 M0h1d+3Q2tvbIHNK66cj5ECrrwzq9JVUYl7FV+mOk3QqTXiE/qKYf3b3Hl8FephMC87q ZfIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RgOfp4sSR468jWzvLG1n7ODOTAkyPnd6W+8Nz2T7kDg=; b=EbWERf8l0Pz53fe6QgAwk4FvRIxSqqpF/pcioO8brqVt3w85unNlLZ3Z7CGi4Idxue OUAoIZZ6izH6GJ1lfXbIbnTMoAacUKrmWip8PoDuzUZOnP2B9UJXbwFJIL8RjNA9sM2I irjoWOjkYPIl5oJNiakyXGlBK80gDJBZYbisJ14MTT8ESy95odx1kSmgqxWgrbTT2c4X x5vILz53l0ZBffumT1HSHwZPIfgKdHDC87+wuulaakfCv3LbB7gwLigJ846ebme4I4od otw5+aPiHfKaYtV70i5rfBsexQ/on+zX6StWpmFaCCpE/s7FPT/4MNSTiwqRy4I4xYmt TqEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s3nwBD3a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170903244a00b0016a2b62efa3si343344pls.394.2022.06.23.11.37.22; Thu, 23 Jun 2022 11:37:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=s3nwBD3a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236768AbiFWSQ1 (ORCPT + 99 others); Thu, 23 Jun 2022 14:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236641AbiFWSPn (ORCPT ); Thu, 23 Jun 2022 14:15:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E4104F9D1; Thu, 23 Jun 2022 10:22:06 -0700 (PDT) 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 A5AB761E0D; Thu, 23 Jun 2022 17:22:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D06CC3411B; Thu, 23 Jun 2022 17:22:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004924; bh=XLle1ULxtnkMGtZ5J8OId3dZzK+gS1ktRIOSKJPKipE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s3nwBD3abQ9Mh2nmSu/E020yZaRH4bLphBgJDkawXDjT9VeDHYiZyfO3DQFnZ7VxK 5A4+1uQGDTBHiSdBvUOA9bdzvOBkXNO1qvIksgjS5fvuKMxu5iSNAQQRmfbQn2pAUG ZWfhgwzIXPPLz87eOOzW4MKO+6QDg/dk4lM8h6tw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chengkaitao , "Michael S. Tsirkin" , Jason Wang , Sasha Levin Subject: [PATCH 4.19 194/234] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed Date: Thu, 23 Jun 2022 18:44:21 +0200 Message-Id: <20220623164348.538321472@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 4cd9ea5c75be..c69c755bf553 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -663,6 +663,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