lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <96a911b2-abca-eee1-334b-52a5bb5a9b6e@redhat.com>
Date:   Sat, 27 Nov 2021 18:09:45 +0100
From:   Eric Auger <eric.auger@...hat.com>
To:     Jean-Philippe Brucker <jean-philippe@...aro.org>, joro@...tes.org,
        will@...nel.org, mst@...hat.com, jasowang@...hat.com
Cc:     virtualization@...ts.linux-foundation.org,
        iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
        sebastien.boeuf@...el.com, kevin.tian@...el.com,
        pasic@...ux.ibm.com
Subject: Re: [PATCH v2 3/5] iommu/virtio: Sort reserved regions

Hi Jean,

On 11/23/21 4:53 PM, Jean-Philippe Brucker wrote:
> To ease identity mapping support, keep the list of reserved regions
> sorted.
>
> Reviewed-by: Kevin Tian <kevin.tian@...el.com>
> Signed-off-by: Jean-Philippe Brucker <jean-philippe@...aro.org>
Reviewed-by: Eric Auger <eric.auger@...hat.com>

Eric
> ---
>  drivers/iommu/virtio-iommu.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iommu/virtio-iommu.c b/drivers/iommu/virtio-iommu.c
> index ee8a7afd667b..d63ec4d11b00 100644
> --- a/drivers/iommu/virtio-iommu.c
> +++ b/drivers/iommu/virtio-iommu.c
> @@ -423,7 +423,7 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
>  	size_t size;
>  	u64 start64, end64;
>  	phys_addr_t start, end;
> -	struct iommu_resv_region *region = NULL;
> +	struct iommu_resv_region *region = NULL, *next;
>  	unsigned long prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO;
>  
>  	start = start64 = le64_to_cpu(mem->start);
> @@ -454,7 +454,12 @@ static int viommu_add_resv_mem(struct viommu_endpoint *vdev,
>  	if (!region)
>  		return -ENOMEM;
>  
> -	list_add(&region->list, &vdev->resv_regions);
> +	/* Keep the list sorted */
> +	list_for_each_entry(next, &vdev->resv_regions, list) {
> +		if (next->start > region->start)
> +			break;
> +	}
> +	list_add_tail(&region->list, &next->list);
>  	return 0;
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ