virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: chengkaitao <pilgrimtao@gmail.com>
Cc: smcdef@gmail.com,
	virtualization <virtualization@lists.linux-foundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>, mst <mst@redhat.com>
Subject: Re: [PATCH] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed
Date: Wed, 8 Jun 2022 16:11:31 +0800	[thread overview]
Message-ID: <CACGkMEvrRmLZ6aqo8J8wxpuqWSbsa=oEOGS+g80bLQzDKv=bww@mail.gmail.com> (raw)
In-Reply-To: <20220602005542.16489-1-chengkaitao@didiglobal.com>

On Thu, Jun 2, 2022 at 9:12 AM chengkaitao <pilgrimtao@gmail.com> wrote:
>
> From: chengkaitao <pilgrimtao@gmail.com>
>
> 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 <pilgrimtao@gmail.com>

Acked-by: Jason Wang <jasowang@redhat.com>

> ---
>  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
>

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

           reply	other threads:[~2022-06-08  8:11 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20220602005542.16489-1-chengkaitao@didiglobal.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACGkMEvrRmLZ6aqo8J8wxpuqWSbsa=oEOGS+g80bLQzDKv=bww@mail.gmail.com' \
    --to=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pilgrimtao@gmail.com \
    --cc=smcdef@gmail.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).