diff mbox series

[v2,1/1] Fix use after free in vfio_migration_probe

Message ID 1604685744-25125-1-git-send-email-kwankhede@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [v2,1/1] Fix use after free in vfio_migration_probe | expand

Commit Message

Kirti Wankhede Nov. 6, 2020, 6:02 p.m. UTC
Fixes Coverity issue:
CID 1436126:  Memory - illegal accesses  (USE_AFTER_FREE)

Fixes: a9e271ec9b36 ("vfio: Add migration region initialization and finalize
function")

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Reviewed-by: David Edmondson <dme@dme.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/vfio/migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Maydell Nov. 12, 2020, 3:57 p.m. UTC | #1
On Fri, 6 Nov 2020 at 18:35, Kirti Wankhede <kwankhede@nvidia.com> wrote:
>
> Fixes Coverity issue:
> CID 1436126:  Memory - illegal accesses  (USE_AFTER_FREE)
>
> Fixes: a9e271ec9b36 ("vfio: Add migration region initialization and finalize
> function")
>
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> Reviewed-by: David Edmondson <dme@dme.org>
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---

Hi Alex -- this is a fix for a Coverity issue, are you planning
a pullreq with it in? It would be nice to have it in rc2 next week.

thanks
-- PMM
Alex Williamson Nov. 12, 2020, 4:59 p.m. UTC | #2
On Thu, 12 Nov 2020 15:57:46 +0000
Peter Maydell <peter.maydell@linaro.org> wrote:

> On Fri, 6 Nov 2020 at 18:35, Kirti Wankhede <kwankhede@nvidia.com> wrote:
> >
> > Fixes Coverity issue:
> > CID 1436126:  Memory - illegal accesses  (USE_AFTER_FREE)
> >
> > Fixes: a9e271ec9b36 ("vfio: Add migration region initialization and finalize
> > function")
> >
> > Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> > Reviewed-by: David Edmondson <dme@dme.org>
> > Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > ---  
> 
> Hi Alex -- this is a fix for a Coverity issue, are you planning
> a pullreq with it in? It would be nice to have it in rc2 next week.

Hi Peter,

Yes, I was planning to send a pull request.  It's a trivial and obvious
fix, so if by chance you'd like to grab it separately, you're also more
than welcome.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Reviewed-by: Alex Williamson <alex.williamson@redhat.com>

Thanks,
Alex
diff mbox series

Patch

diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 3ce285ea395d..55261562d4f3 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -897,8 +897,8 @@  int vfio_migration_probe(VFIODevice *vbasedev, Error **errp)
         goto add_blocker;
     }
 
-    g_free(info);
     trace_vfio_migration_probe(vbasedev->name, info->index);
+    g_free(info);
     return 0;
 
 add_blocker: