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: <18cb711a-de2a-69e3-d753-7012a67bf2a7@linux.intel.com>
Date:   Mon, 11 Apr 2022 10:28:11 -0500
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     Zheyu Ma <zheyuma97@...il.com>, lgirdwood@...il.com,
        ranjani.sridharan@...ux.intel.com, kai.vehmanen@...ux.intel.com,
        broonie@...nel.org, perex@...ex.cz, tiwai@...e.com,
        peter.ujfalusi@...ux.intel.com
Cc:     alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
        sound-open-firmware@...a-project.org
Subject: Re: [PATCH] ASoC: SOF: Intel: Check the bar size before remapping



On 4/9/22 09:39, Zheyu Ma wrote:
> The driver should use the pci_resource_len() to get the actual length of
> pci bar, and compare it with the expect value. If the bar size is too
> small (such as a broken device), the driver should return an error.
> 
> Signed-off-by: Zheyu Ma <zheyuma97@...il.com>
> ---
>  sound/soc/sof/intel/pci-tng.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/sof/intel/pci-tng.c b/sound/soc/sof/intel/pci-tng.c
> index 6efef225973f..7d502cc3ca80 100644
> --- a/sound/soc/sof/intel/pci-tng.c
> +++ b/sound/soc/sof/intel/pci-tng.c
> @@ -75,7 +75,11 @@ static int tangier_pci_probe(struct snd_sof_dev *sdev)
>  
>  	/* LPE base */
>  	base = pci_resource_start(pci, desc->resindex_lpe_base) - IRAM_OFFSET;
> -	size = PCI_BAR_SIZE;
> +	size = pci_resource_len(pci, desc->resindex_lpe_base);
> +	if (size < PCI_BAR_SIZE) {
> +		dev_err(sdev->dev, "error: I/O region is too small.\n");
> +		return -ENODEV;
> +	}

May I ask how you found this issue?

I am not clear on why there's a patch dedicated for a single device, but the same pattern in hda.c and in the HDaudio legacy driver exists.

>  
>  	dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size);
>  	sdev->bar[DSP_BAR] = devm_ioremap(sdev->dev, base, size);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ