Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2321165iof; Wed, 8 Jun 2022 02:23:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrWyKWoQ1jJ2D5QIqbrpYrrtDp02AZNeHr9/6VRGo5ggJy9fJuqAoDxC+Z1TpZr0zMVVMp X-Received: by 2002:a17:90a:c7cf:b0:1e8:2b77:7835 with SMTP id gf15-20020a17090ac7cf00b001e82b777835mr30589984pjb.109.1654680228215; Wed, 08 Jun 2022 02:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654680228; cv=none; d=google.com; s=arc-20160816; b=xpWuhEYQsjjEL3VqM2/O2WJQOFuhecTvXPd0Nuq+YcQK7oNewAIEsv18W44OR4ngzc D1tNcrFIcZMOSsbVM6TGqninaoopN3WFKVHQ4QwE7Dp2T5LVIYsdRzbmWpUDHw5bHaru hX1sycON7A7pGtaKMea9zx2jqw3jFDKuO6vSGHB66S7pVgTX1XqlUZZADLy6Y2t8FGqX 1x22EF6GiFT2ZBu051FnGWuOS+N+wGNLu6eJXwiV58GILoZI6NtXqVz5lTTXlWp5bR/i AEDXB9qNspPG6IXDVq/hFbnmVNHz9KikYfPh5gTwPpuEJWRHopQT1wk/xp9x/WlRgzsY sKjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wnBT58Y92YriRHNYFwkaJJZXg0dEepk6NxGeotGng9s=; b=jC3ta1641gNg1Rl6SrJXKcXhSFiDykNdrJR94UZjwZZT5z/N73Ajf8XgV6sGBbZh7G iqly4ByBs+0+2PSfjCBnqQOVI7V+Mu9TkVj0ePtqM3s+VOPO9x5xQY0VjL2SI9oPasws mQDOVN1RxS7rMcuhggmPYVFd8HOWLd35GGKzHtcKhUDn/W3V7orMQ6WNlzIsntMd5ygF qnsOxP0pPLRJreGO7HZfmC2/bXRL7bg6S7L8JcmBTCmd/WxrEehhTJUHFkHzTZMP3kD8 HsT8udomJfQ6mkNyec6S+RUQDNqs2bcz+m3RH34tD4dmI1R9mz/SbqqGYYtS60PUUgG4 IY/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CguiZdMP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id bg13-20020a056a02010d00b003fdf4a14a22si6849967pgb.51.2022.06.08.02.23.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 02:23:48 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CguiZdMP; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 98C0F136E82; Wed, 8 Jun 2022 01:54:03 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231871AbiFHIxs (ORCPT + 99 others); Wed, 8 Jun 2022 04:53:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231140AbiFHIw7 (ORCPT ); Wed, 8 Jun 2022 04:52:59 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2439F2A46DD for ; Wed, 8 Jun 2022 01:11:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1654675906; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wnBT58Y92YriRHNYFwkaJJZXg0dEepk6NxGeotGng9s=; b=CguiZdMPoC+Rbh6/NTkNLPHHf6FEWaQpiN/k0/q5EtKZUsnVa1oBy1FEw5Ks5SpHiODiN/ kVl+XoI3mpXUdQCxtX1mj4n61FYaLdyhVXz59mK9Qbw4vbj8EdZSDXSFjyTGT3HLb0vkkY z6gFrz1gcVC80IUh2r2y3KkbZTuK5bE= Received: from mail-lj1-f199.google.com (mail-lj1-f199.google.com [209.85.208.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-602-zqnrx_NMOaehSfMsnEnx9g-1; Wed, 08 Jun 2022 04:11:44 -0400 X-MC-Unique: zqnrx_NMOaehSfMsnEnx9g-1 Received: by mail-lj1-f199.google.com with SMTP id b26-20020a2e989a000000b002556f92fa13so3415861ljj.15 for ; Wed, 08 Jun 2022 01:11:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wnBT58Y92YriRHNYFwkaJJZXg0dEepk6NxGeotGng9s=; b=fmy/lPvsuCw+VnZRee6Ay/rw3SsjKawrBFTLfBOl2UVA+X3wM7/I+6WYfUVugwpOwK fBV8OwwIMlV5uMa7plRr2hUMd1SFPAypgKT5okoTNZCMKU+api7W9+X36rWUecRkwQAl sDnK38IeM/7sNvc7nuO+kdffbSlXDFOhMRaDMXEWwIIcsJkmnqIfzb+bIvt/ACNPb0YX QVH2PYnXBkpJmf1/Q12ky8kd0XdEVOsjzRc738XAa1LLt3Ll8pzS7gUJz/MGVh/noJvc vFOVeYZBfXKCLNwtzJYESM/eZGLLtE/W0HIsyO1lZfg2w1141RmVr/x9ny1GiCxLqW0j 7ytQ== X-Gm-Message-State: AOAM532Odq/dnoZX6/hsMPNNGayRjZ8/ZsLy+/l+Xlu4juZmoQNu5A2C KmLeeRa1IUJNxJpvbmy6MxuIN0cR29Y9ou9I6OdN5XMJr1O+XloUytHoz60RTuIA8k1tDihNm+t jHC1vPBHQWIWUP5JmQ1gIeFH6TzBAtVYqeB9Z8aHY X-Received: by 2002:a2e:bc05:0:b0:24b:212d:7521 with SMTP id b5-20020a2ebc05000000b0024b212d7521mr54616041ljf.243.1654675903266; Wed, 08 Jun 2022 01:11:43 -0700 (PDT) X-Received: by 2002:a2e:bc05:0:b0:24b:212d:7521 with SMTP id b5-20020a2ebc05000000b0024b212d7521mr54616032ljf.243.1654675903108; Wed, 08 Jun 2022 01:11:43 -0700 (PDT) MIME-Version: 1.0 References: <20220602005542.16489-1-chengkaitao@didiglobal.com> In-Reply-To: <20220602005542.16489-1-chengkaitao@didiglobal.com> From: Jason Wang Date: Wed, 8 Jun 2022 16:11:31 +0800 Message-ID: Subject: Re: [PATCH] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed To: chengkaitao Cc: mst , virtualization , linux-kernel , smcdef@gmail.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 On Thu, Jun 2, 2022 at 9:12 AM chengkaitao wrote: > > From: chengkaitao > > 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 Acked-by: Jason Wang > --- > 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.14.1 >