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, 21 Aug 2014 15:54:17 -0600
From:	Alex Williamson <alex.williamson@...hat.com>
To:	Joerg Roedel <joro@...tes.org>
Cc:	iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
	David Woodhouse <dwmw2@...radead.org>,
	Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 1/2] iommu: Make iommu_group_get_for_dev() more robust

On Thu, 2014-08-21 at 23:37 +0200, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@...e.de>
> 
> When a non-PCI device is passed to that function it might
> pass group == NULL to iommu_group_add_device() which then
> dereferences it and cause a crash this way. Fix it by
> just returning an error for non-PCI devices.
> 
> Fixes: 104a1c13ac66e40cf8c6ae74d76ff14ff24b9b01
> Cc: Alex Williamson <alex.williamson@...hat.com>
> Signed-off-by: Joerg Roedel <jroedel@...e.de>
> ---
>  drivers/iommu/iommu.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index 1698360..ef8da12 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -678,15 +678,17 @@ static struct iommu_group *iommu_group_get_for_pci_dev(struct pci_dev *pdev)
>   */
>  struct iommu_group *iommu_group_get_for_dev(struct device *dev)
>  {
> -	struct iommu_group *group = ERR_PTR(-EIO);
> +	struct iommu_group *group;
>  	int ret;
>  
>  	group = iommu_group_get(dev);
>  	if (group)
>  		return group;

Hmm, I bet I had a second pointer for this case but mistakenly optimized
it out refining the patch.  This solution works too though.

Acked-by: Alex Williamson <alex.williamson@...hat.com>

Thanks!
Alex

>  
> -	if (dev_is_pci(dev))
> -		group = iommu_group_get_for_pci_dev(to_pci_dev(dev));
> +	if (!dev_is_pci(dev))
> +		return ERR_PTR(-EINVAL);
> +
> +	group = iommu_group_get_for_pci_dev(to_pci_dev(dev));
>  
>  	if (IS_ERR(group))
>  		return group;



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ