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-next>] [day] [month] [year] [list]
Date:	Fri, 17 Apr 2009 22:51:05 +0100
From:	David Woodhouse <dwmw2@...radead.org>
To:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:	Joerg Roedel <joerg.roedel@....com>, reinette.chatre@...el.com,
	benh@...nel.crashing.org, greg@...ah.com
Subject: Re: dma-debug: add a check dma memory leaks

On Mon, 2009-03-30 at 21:01 +0000, Linux Kernel Mailing List wrote:
> Gitweb:     http://git.kernel.org/linus/41531c8f5f05aba5ec645d9770557eedbf75b422
> Commit:     41531c8f5f05aba5ec645d9770557eedbf75b422

>     dma-debug: add a check dma memory leaks
>     
>     Impact: allow architectures to monitor busses for dma mem leakage
>     
>     This patch adds checking code to detect if a device has pending DMA
>     operations when it is about to be unbound from its device driver.
>     
>     Signed-off-by: Joerg Roedel <joerg.roedel@....com>


> +static int dma_debug_device_change(struct notifier_block *nb,
> +				    unsigned long action, void *data)
> +{
> +	struct device *dev = data;
> +	int count;
> +
> +
> +	switch (action) {
> +	case BUS_NOTIFY_UNBIND_DRIVER:
> +		count = device_dma_allocations(dev);
> +		if (count == 0)
> +			break;
> +		err_printk(dev, NULL, "DMA-API: device driver has pending "
> +				"DMA allocations while released from device "
> +				"[count=%d]\n", count);

Hm, cute... but not quite functioning as you intended. If you look at
__device_release_driver() in drivers/base/dd.c you'll see it actually
calls the notifier _before_ calling into the driver's ->remove() method.
So it's hardly surprising that not everything has been freed yet...

Reported by Reinette when it bit iwlwifi.

Ben, can we get away with changing the order so that the ->remove() is
called before the notifier, in this case? 

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@...el.com                              Intel Corporation

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