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] [day] [month] [year] [list]
Message-ID: <74f8916b-72ce-fc8c-a1c2-0f38ea99ab6d@rock-chips.com>
Date:   Tue, 19 Mar 2019 08:43:13 +0800
From:   Shawn Lin <shawn.lin@...k-chips.com>
To:     Aditya Pakki <pakki001@....edu>
Cc:     shawn.lin@...k-chips.com, kjlu@....edu,
        Jaehoon Chung <jh80.chung@...sung.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        Kukjin Kim <kgene@...nel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>,
        linux-mmc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mmc: dw_mmc: Fix to avoid potential NULL pointer dereference【请注意,邮件由linux-mmc-owner@...r.kernel.org代发】

On 2019/3/19 8:19, Aditya Pakki wrote:
> of_match_node can fail and return NULL in case no matching structure.
> The patches checks for such a scenario and returns -ENXIO.
> 
> Signed-off-by: Aditya Pakki <pakki001@....edu>
> ---
>   drivers/mmc/host/dw_mmc-exynos.c | 2 ++
>   drivers/mmc/host/dw_mmc-k3.c     | 2 ++
>   drivers/mmc/host/dw_mmc-pltfm.c  | 2 ++
>   3 files changed, 6 insertions(+)
> 

Could you check dw_mmc-zx.c and dw_mmc-rockchip.c as well?

> diff --git a/drivers/mmc/host/dw_mmc-exynos.c b/drivers/mmc/host/dw_mmc-exynos.c
> index d46c3439b508..8a75d7314606 100644
> --- a/drivers/mmc/host/dw_mmc-exynos.c
> +++ b/drivers/mmc/host/dw_mmc-exynos.c
> @@ -554,6 +554,8 @@ static int dw_mci_exynos_probe(struct platform_device *pdev)
>   	int ret;
>   
>   	match = of_match_node(dw_mci_exynos_match, pdev->dev.of_node);
> +	if (!match)
> +		return -ENXIO;
>   	drv_data = match->data;
>   
>   	pm_runtime_get_noresume(&pdev->dev);
> diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c
> index 89cdb3d533bb..cc50b7546a20 100644
> --- a/drivers/mmc/host/dw_mmc-k3.c
> +++ b/drivers/mmc/host/dw_mmc-k3.c
> @@ -459,6 +459,8 @@ static int dw_mci_k3_probe(struct platform_device *pdev)
>   	const struct of_device_id *match;
>   
>   	match = of_match_node(dw_mci_k3_match, pdev->dev.of_node);
> +	if (!match)
> +		return -ENXIO;
>   	drv_data = match->data;
>   
>   	return dw_mci_pltfm_register(pdev, drv_data);
> diff --git a/drivers/mmc/host/dw_mmc-pltfm.c b/drivers/mmc/host/dw_mmc-pltfm.c
> index 58c13e21bd5a..b1948989f617 100644
> --- a/drivers/mmc/host/dw_mmc-pltfm.c
> +++ b/drivers/mmc/host/dw_mmc-pltfm.c
> @@ -82,6 +82,8 @@ static int dw_mci_pltfm_probe(struct platform_device *pdev)
>   
>   	if (pdev->dev.of_node) {
>   		match = of_match_node(dw_mci_pltfm_match, pdev->dev.of_node);
> +		if (!match)
> +			return -ENXIO;
>   		drv_data = match->data;
>   	}
>   
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ