[PATCH] fix hwa-hc / hwa-rc binary module dependencies

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Christopher Friedt (1):
  Corrected missing binary module dependency of hwa-hc on hwa-rc and
    consistent probe failure of hwa-hc. The problem: hwa-rc did not
    export any symbols, but hwa-hc depended on it. Hwa-hc gets its
    uwb_rc through private driver data. If hwa-rc is not loaded prior
    to hwa-hc, then that private driver data is NULL. The problem is
    fixed manually by loading hwa-rc and then hwa-hc. However, due to
    the missing binary module dependency (i.e. "Used by" field in
    lsmod), one can rmove the hwa-rc module while the hwa-hc module is
    loaded, leaving any pointers to the uwb_rc struct invalid. This
    patch is obviously mainly for illustrative purposes, but it does
    actually fix both of the aforementioned problems.

 drivers/usb/host/hwa-hc.c |    4 ++++
 drivers/uwb/hwa-rc.c      |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)

>From 9c29727e25a7952caf906665ae31a542ced86405 Mon Sep 17 00:00:00 2001
From: Christopher Friedt <chrisfriedt@xxxxxxxxx>
Date: Wed, 25 Aug 2010 13:34:47 +0200
Subject: [PATCH] Corrected missing binary module dependency of hwa-hc on hwa-rc and consistent probe failure of hwa-hc. The problem: hwa-rc did not export any symbols, but hwa-hc depended on it. Hwa-hc gets its uwb_rc through private driver data. If hwa-rc is not loaded prior to hwa-hc, then that private driver data is NULL. The problem is fixed manually by loading hwa-rc and then hwa-hc. However, due to the missing binary module dependency (i.e. "Used by" field in lsmod), one can rmove the hwa-rc module while the hwa-hc module is loaded, leaving any pointers to the uwb_rc struct invalid. This patch is obviously mainly for illustrative purposes, but it does actually fix both of the aforementioned problems.
Cc: chrisfriedt@xxxxxxxxx

Signed-off-by: Christopher Friedt <chrisfriedt@xxxxxxxxx>
---
 drivers/usb/host/hwa-hc.c |    4 ++++
 drivers/uwb/hwa-rc.c      |    5 +++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c
index 9bfac65..2d61e4d 100644
--- a/drivers/usb/host/hwa-hc.c
+++ b/drivers/usb/host/hwa-hc.c
@@ -837,8 +837,12 @@ static struct usb_driver hwahc_driver = {
 	.id_table =	hwahc_id_table,
 };
 
+/* required to ensure that hwa-rc loads before hwa-hc */
+extern hwarc_dummy_func(void);
+
 static int __init hwahc_driver_init(void)
 {
+	hwarc_dummy_func();
 	return usb_register(&hwahc_driver);
 }
 module_init(hwahc_driver_init);
diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 2babcd4..43777f0 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -914,6 +914,11 @@ static struct usb_driver hwarc_driver = {
 	.post_reset =   hwarc_post_reset,
 };
 
+/* required to ensure that hwa-rc loads before hwa-hc */
+void hwarc_dummy_func(void) {
+}
+EXPORT_SYMBOL_GPL(hwarc_dummy_func);
+
 static int __init hwarc_driver_init(void)
 {
 	return usb_register(&hwarc_driver);
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux