Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6144822iog; Thu, 23 Jun 2022 12:16:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vpxL4v5h3iBPOMclwewgr7qExlFbTC5xAkXoh0F/Qh0E0BTDEcgKLVotPPuE2ilKsp7buB X-Received: by 2002:a17:903:2350:b0:16a:4246:f1b6 with SMTP id c16-20020a170903235000b0016a4246f1b6mr11543919plh.35.1656011780078; Thu, 23 Jun 2022 12:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011780; cv=none; d=google.com; s=arc-20160816; b=fJ+98eSvHvOblYzerETjJsNDnBxrO+a1wgRiAxBCxX/AnDeWsnI3Kmhw3J/QNi+Pph uS2hjVFPvaPzX51b9A+kaqIV673Wc2wyrIqeJqyTxNHM8W9VBzxK+9bB8oFz4Kkv2rOb DdzzccVF9FlRwnV/v0AHn9b12/EgbboO648FJ0KMFpeVm24A6ddYOu0FGMi2kJrgUF+R xBH6MFWGSh8q2VnHnFIA7+kGh9+PZgugvg92A6de3BhN7GDYLIili4Cz/n0WKIHUt48d sYjTvqPwIa/Q5lW+TpVfaSb0dAvtzdskfCuoCuEfs9/A5Vw/f/LlAcUHPY1lDkyROpx2 AFnA== 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=8M/w3COwlkOj5ewpPB7uoiqS1vOLENZKXTdgz2tRcA4=; b=Z0LgW2ErXzISmbMcViv885kPLCpk2UKAc6H8YNtn0PiJdK90oHjwVmKNa2OXU8D90/ g8h+9P31rhr8kvfKtqm4omSU0ddVuEIW5ZKpVxOYUZwdewV5EfjW35FpwfJzMkK3TTrE CybyRhtzPxwrzNEkDmsWoUS36xq7jaQxZBPcknOfUXvflfZeb9p301UrMAfxrA97QEdk vNcmk30rW3Nk5i+eWDZbyx42l99aIsUTc50UfsEjkQL0i5dkPLb4b+faRZa+f5Wt5RxW JdZneRhE5xzOYXttNx0WSdV5ifIuTh/gzRGYufDgePp9K8YgRA7mTFDN1VJ4YeVoyLMd +g2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="s/659mSh"; 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 cj18-20020a056a00299200b00522c3a00ee9si26474353pfb.270.2022.06.23.12.16.08; Thu, 23 Jun 2022 12:16:20 -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="s/659mSh"; 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 S231924AbiFWRLE (ORCPT + 99 others); Thu, 23 Jun 2022 13:11:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234090AbiFWRIp (ORCPT ); Thu, 23 Jun 2022 13:08:45 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB2855534F; Thu, 23 Jun 2022 09:57:23 -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 sin.source.kernel.org (Postfix) with ESMTPS id 5DC05CE25DE; Thu, 23 Jun 2022 16:57:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D513C3411B; Thu, 23 Jun 2022 16:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656003421; bh=o/jyu2ROdm31y2b8cgGf9XEmM2oEVHame+hPgu7jdd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s/659mShPveaWlfWI3+G09saMyth9PAPDPD7yU7GvSytw1szXvKc2pcgSupeCL6b0 yHOeV9ogzTxfhf3IzZoxynqOfVgonH0LtslZycNfCuvTjBa9eyUm0EwIFxBQmjokst vXKC7cjDeGpauUzl2nwz5HAh2FMHvvZzTGfgzr4g= 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.9 233/264] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed Date: Thu, 23 Jun 2022 18:43:46 +0200 Message-Id: <20220623164350.670172215@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@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 50840984fbfa..f62da3b7c27b 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -630,6 +630,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