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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3793c2e8-15ad-2628-0660-f04d4f1071fd@loongson.cn>
Date:   Tue, 18 Oct 2022 21:31:16 +0800
From:   Jianmin Lv <lvjianmin@...ngson.cn>
To:     Robin Murphy <robin.murphy@....com>, rafael@...nel.org
Cc:     yangyicong@...wei.com, lpieralisi@...nel.org,
        chenhuacai@...ngson.cn, linux-acpi@...r.kernel.org,
        linux-kernel@...r.kernel.org, lenb@...nel.org,
        jeremy.linton@....com
Subject: Re: [PATCH] ACPI: scan: Fix DMA range assignment

Seems good. Thanks very much.

Reviewed-by: Jianmin Lv <lvjianmin@...ngson.cn>

On 2022/10/18 下午9:14, Robin Murphy wrote:
> Assigning the device's dma_range_map from the iterator variable after
> the loop means it always points to the empty terminator at the end of
> the map, which is not what we want. Similarly, freeing the iterator on
> error when it points to somwhere in the middle of the allocated array
> won't work either. Fix this.
> 
> Fixes: bf2ee8d0c385 ("ACPI: scan: Support multiple DMA windows with different offsets")
> Signed-off-by: Robin Murphy <robin.murphy@....com>
> ---
>   drivers/acpi/scan.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 558664d169fc..024cc373a197 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -1509,9 +1509,12 @@ int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map)
>   			goto out;
>   		}
>   
> +		*map = r;
> +
>   		list_for_each_entry(rentry, &list, node) {
>   			if (rentry->res->start >= rentry->res->end) {
> -				kfree(r);
> +				kfree(*map);
> +				*map = NULL;
>   				ret = -EINVAL;
>   				dev_dbg(dma_dev, "Invalid DMA regions configuration\n");
>   				goto out;
> @@ -1523,8 +1526,6 @@ int acpi_dma_get_range(struct device *dev, const struct bus_dma_region **map)
>   			r->offset = rentry->offset;
>   			r++;
>   		}
> -
> -		*map = r;
>   	}
>    out:
>   	acpi_dev_free_resource_list(&list);
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ