Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 82189b98 authored by Catalin Marinas's avatar Catalin Marinas Committed by Linus Torvalds
Browse files

[PATCH] Fix device_attribute memory leak in device_del



dev->devt_attr is allocated in device_add() but it is never freed in
device_del() in the drivers/base/core.c file (reported by kmemleak).

Signed-off-by: default avatarCatalin Marinas <catalin.marinas@gmail.com>
Acked-by: default avatarGreg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 533221fb
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -591,8 +591,10 @@ void device_del(struct device * dev)

	if (parent)
		klist_del(&dev->knode_parent);
	if (dev->devt_attr)
	if (dev->devt_attr) {
		device_remove_file(dev, dev->devt_attr);
		kfree(dev->devt_attr);
	}
	if (dev->class) {
		sysfs_remove_link(&dev->kobj, "subsystem");
		sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id);