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]
Date:	Tue, 1 May 2007 20:08:03 +0100
From:	Russell King <rmk+lkml@....linux.org.uk>
To:	Paul Sokolovsky <pmiscml@...il.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: [RFC, PATCH 1/4] SoC base drivers: SoC helper API

On Tue, May 01, 2007 at 08:08:27AM +0300, Paul Sokolovsky wrote:
> +void soc_free_devices(struct platform_device *devices, int nr_devs)
> +{
> +	struct platform_device *dev = devices;
> +	int i;
> +
> +	for (i = 0; i < nr_devs; i++) {
> +		struct resource *res = dev->resource;
> +		platform_device_unregister(dev++);
> +		kfree(res);
> +	}
> +	kfree(devices);

Utterly unsafe.  Repeat after me: kfreeing the memory assocated with any
kobject is asking for an OOPS.  Do not do it.

There's a reason that platform_device_alloc() and friends exist.  If you
want to unregister platform devices, use those functions.  Don't try to
invent your own buggy variants.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:
-
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