[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210625090446.46da71e7.alex.williamson@redhat.com>
Date: Fri, 25 Jun 2021 09:04:46 -0600
From: Alex Williamson <alex.williamson@...hat.com>
To: Colin King <colin.king@...onical.com>
Cc: Kirti Wankhede <kwankhede@...dia.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jason Gunthorpe <jgg@...pe.ca>, kvm@...r.kernel.org,
kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] vfio/mdpy: Fix memory leak of object
mdev_state->vconfig
On Tue, 22 Jun 2021 19:37:10 +0100
Colin King <colin.king@...onical.com> wrote:
> From: Colin Ian King <colin.king@...onical.com>
>
> In the case where the call to vfio_register_group_dev fails the error
> return path kfree's mdev_state but not mdev_state->vconfig. Fix this
> by kfree'ing mdev_state->vconfig before returning.
>
> Addresses-Coverity: ("Resource leak")
> Fixes: 437e41368c01 ("vfio/mdpy: Convert to use vfio_register_group_dev()")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> samples/vfio-mdev/mdpy.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/samples/vfio-mdev/mdpy.c b/samples/vfio-mdev/mdpy.c
> index 7e9c9df0f05b..393c9df6f6a0 100644
> --- a/samples/vfio-mdev/mdpy.c
> +++ b/samples/vfio-mdev/mdpy.c
> @@ -261,6 +261,7 @@ static int mdpy_probe(struct mdev_device *mdev)
>
> ret = vfio_register_group_dev(&mdev_state->vdev);
> if (ret) {
> + kfree(mdev_state->vconfig);
> kfree(mdev_state);
> return ret;
> }
Applied to vfio next branch for v5.14, thanks!
Alex
Powered by blists - more mailing lists