[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <11722725592291-git-send-email-gregkh@suse.de>
Date: Fri, 23 Feb 2007 15:15:49 -0800
From: Greg Kroah-Hartman <gregkh@...e.de>
To: linux-kernel@...r.kernel.org
Cc: Mike Galbraith <efault@....de>,
Andrew Morton <akpm@...ux-foundation.org>,
Greg Kroah-Hartman <gregkh@...e.de>
Subject: [PATCH 2/9] driver core: refcounting fix
From: Mike Galbraith <efault@....de>
Fix a reference counting bug exposed by commit
725522b5453dd680412f2b6463a988e4fd148757. If driver.mod_name exists, we
take a reference in module_add_driver(), and never release it. Undo that
reference in module_remove_driver().
Signed-off-by: Mike Galbraith <efault@....de>
Cc: Kay Sievers <kay.sievers@...y.org>
Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
---
kernel/module.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 8c25b1a..1ecf081 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2425,6 +2425,12 @@ void module_remove_driver(struct device_driver *drv)
kfree(driver_name);
}
}
+ /*
+ * Undo the additional reference we added in module_add_driver()
+ * via kset_find_obj()
+ */
+ if (drv->mod_name)
+ kobject_put(&drv->kobj);
}
EXPORT_SYMBOL(module_remove_driver);
#endif
--
1.5.0.1
-
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