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:	Tue, 4 Mar 2014 15:31:58 +0100
From:	Joerg Roedel <joro@...tes.org>
To:	Yijing Wang <wangyijing@...wei.com>
Cc:	Alex Williamson <alex.williamson@...hat.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	David Woodhouse <dwmw2@...radead.org>,
	Vinod Koul <vinod.koul@...el.com>,
	Dan Williams <dan.j.williams@...el.com>,
	dmaengine@...r.kernel.org, iommu@...ts.linux-foundation.org,
	linux-kernel@...r.kernel.org, Hanjun Guo <guohanjun@...wei.com>
Subject: Re: [PATCH v2] IOMMU: enhance dmar to support device hotplug

On Thu, Nov 21, 2013 at 04:21:56PM +0800, Yijing Wang wrote:
> @@ -3641,21 +3681,42 @@ static int device_notifier(struct notifier_block *nb,
>  	struct device *dev = data;
>  	struct pci_dev *pdev = to_pci_dev(dev);
>  	struct dmar_domain *domain;
> +	struct dmar_device *dmar_dev;
> +	struct dmar_drhd_unit *drhd;
>  
> -	if (iommu_no_mapping(dev))
> -		return 0;
> -
> -	domain = find_domain(pdev);
> -	if (!domain)
> -		return 0;
> +	switch (action) {
> +	case BUS_NOTIFY_ADD_DEVICE:
> +		for_each_drhd_unit(drhd)
> +			list_for_each_entry(dmar_dev, &drhd->devices, list)
> +				if (dmar_dev->segment == pci_domain_nr(pdev->bus)
> +					&& dmar_dev->bus == pdev->bus->number
> +					&& dmar_dev->devfn == pdev->devfn)
> +					dmar_dev->pdev = pci_dev_get(pdev);
> +		break;
> +	case BUS_NOTIFY_DEL_DEVICE:
> +		for_each_drhd_unit(drhd)
> +			list_for_each_entry(dmar_dev, &drhd->devices, list)
> +				if (dmar_dev->pdev == pdev) {
> +					pci_dev_put(pdev);
> +					dmar_dev->pdev = NULL;
> +				}

How is that synchronized with other users of this dmar_dev structure.
Could it happen that you drop the device reference while other parts of
the driver still use it?


	Joerg


--
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