Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-14 Thread Nicolin Chen
On Wed, Sep 14, 2022 at 02:03:25PM -0600, Alex Williamson wrote: > > > > +container->pgsizes = 4096; > > > > > > This might be a separate question/issue: I wonder if we should use > > > "sysconf(_SC_PAGE_SIZE)" here instead of 4096. > > > > > > With a kernel using a larger page size, e.g.

Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-14 Thread Alex Williamson
On Wed, 14 Sep 2022 13:53:39 -0600 Alex Williamson wrote: > On Wed, 14 Sep 2022 12:02:56 -0700 > Nicolin Chen wrote: > > > Hi Alex, > > > > On Wed, Sep 14, 2022 at 12:10:29PM -0600, Alex Williamson wrote: > > > > > > > > Its caller vfio_connect_container() assigns a default value > > > > >

Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-14 Thread Alex Williamson
On Wed, 14 Sep 2022 12:02:56 -0700 Nicolin Chen wrote: > Hi Alex, > > On Wed, Sep 14, 2022 at 12:10:29PM -0600, Alex Williamson wrote: > > > > > > Its caller vfio_connect_container() assigns a default value > > > > > to info->iova_pgsizes, even if vfio_get_iommu_info() fails. > > > > > This wou

Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-14 Thread Nicolin Chen
Hi Alex, On Wed, Sep 14, 2022 at 12:10:29PM -0600, Alex Williamson wrote: > > > > Its caller vfio_connect_container() assigns a default value > > > > to info->iova_pgsizes, even if vfio_get_iommu_info() fails. > > > > This would result in a "Segmentation fault" error, when the > > > > VFIO_IOMMU_

Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-14 Thread Alex Williamson
On Wed, 14 Sep 2022 12:10:29 -0600 Alex Williamson wrote: > On Mon, 12 Sep 2022 13:51:30 -0700 > Nicolin Chen wrote: > > > On Mon, Sep 12, 2022 at 02:38:52PM +0200, Cornelia Huck wrote: > > > External email: Use caution opening links or attachments > > > > > > > > > On Fri, Sep 09 2022, Nic

Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-14 Thread Alex Williamson
On Mon, 12 Sep 2022 13:51:30 -0700 Nicolin Chen wrote: > On Mon, Sep 12, 2022 at 02:38:52PM +0200, Cornelia Huck wrote: > > External email: Use caution opening links or attachments > > > > > > On Fri, Sep 09 2022, Nicolin Chen wrote: > > > > > Its caller vfio_connect_container() assigns a d

Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-12 Thread Nicolin Chen
On Mon, Sep 12, 2022 at 02:38:52PM +0200, Cornelia Huck wrote: > External email: Use caution opening links or attachments > > > On Fri, Sep 09 2022, Nicolin Chen wrote: > > > Its caller vfio_connect_container() assigns a default value > > to info->iova_pgsizes, even if vfio_get_iommu_info() fai

Re: [PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-12 Thread Cornelia Huck
On Fri, Sep 09 2022, Nicolin Chen wrote: > Its caller vfio_connect_container() assigns a default value > to info->iova_pgsizes, even if vfio_get_iommu_info() fails. > This would result in a "Segmentation fault" error, when the > VFIO_IOMMU_GET_INFO ioctl errors out. > > Since the caller has g_fre

[PATCH] vfio/common: Do not g_free in vfio_get_iommu_info

2022-09-09 Thread Nicolin Chen
Its caller vfio_connect_container() assigns a default value to info->iova_pgsizes, even if vfio_get_iommu_info() fails. This would result in a "Segmentation fault" error, when the VFIO_IOMMU_GET_INFO ioctl errors out. Since the caller has g_free already, drop the g_free in its rollback routine and