https://github.com/torvalds/linux
Revision c27f3efc56080a246f6ab7f57f0a6f56d256d769 authored by Johan Hovold on 17 October 2012, 11:34:57 UTC, committed by Greg Kroah-Hartman on 17 October 2012, 20:47:58 UTC
Fix port-data memory leak by moving port data allocation and
deallocation to port_probe and port_remove.

Since commit 0998d0631001288 (device-core: Ensure drvdata = NULL when no
driver is bound) the port private data is no longer freed at release as
it is no longer accessible.

Compile-only tested.

Cc: <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 95940a0
Raw File
Tip revision: c27f3efc56080a246f6ab7f57f0a6f56d256d769 authored by Johan Hovold on 17 October 2012, 11:34:57 UTC
USB: io_edgeport: fix port-data memory leak
Tip revision: c27f3ef
gcd.c
#include <linux/kernel.h>
#include <linux/gcd.h>
#include <linux/export.h>

/* Greatest common divisor */
unsigned long gcd(unsigned long a, unsigned long b)
{
	unsigned long r;

	if (a < b)
		swap(a, b);

	if (!b)
		return a;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
EXPORT_SYMBOL_GPL(gcd);
back to top