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]
Date:   Thu, 24 Aug 2017 15:11:37 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Baoquan He <bhe@...hat.com>
Cc:     iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
        joro@...tes.org
Subject: Re: [PATCH] iommu/amd: Check if domain is NULL before dereference it

On Thu, Aug 24, 2017 at 07:56:47PM +0800, Baoquan He wrote:
> In get_domain(), 'domain' could still be NULL before it's passed to
> dma_ops_domain() to dereference. For safety, check if 'domain' is
> NULL before passing to dma_ops_domain().
> 
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Baoquan He <bhe@...hat.com>
> ---
>  drivers/iommu/amd_iommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
> index 16f1e6af00b0..2e2d5e6a13b3 100644
> --- a/drivers/iommu/amd_iommu.c
> +++ b/drivers/iommu/amd_iommu.c
> @@ -2262,7 +2262,7 @@ static struct protection_domain *get_domain(struct device *dev)
>  		domain = to_pdomain(io_domain);
>  		attach_device(dev, domain);
>  	}
> -	if (!dma_ops_domain(domain))
> +	if (domain && !dma_ops_domain(domain))
>  		return ERR_PTR(-EBUSY);
>  
>  	return domain;

This still doesn't look right.  None of the callers can handle a NULL
domain.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ