[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACGkMEvrRmLZ6aqo8J8wxpuqWSbsa=oEOGS+g80bLQzDKv=bww@mail.gmail.com>
Date: Wed, 8 Jun 2022 16:11:31 +0800
From: Jason Wang <jasowang@...hat.com>
To: chengkaitao <pilgrimtao@...il.com>
Cc: mst <mst@...hat.com>,
virtualization <virtualization@...ts.linux-foundation.org>,
linux-kernel <linux-kernel@...r.kernel.org>, smcdef@...il.com
Subject: Re: [PATCH] virtio-mmio: fix missing put_device() when
vm_cmdline_parent registration failed
On Thu, Jun 2, 2022 at 9:12 AM chengkaitao <pilgrimtao@...il.com> wrote:
>
> From: chengkaitao <pilgrimtao@...il.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@...il.com>
Acked-by: Jason Wang <jasowang@...hat.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
>
Powered by blists - more mailing lists