[OpenWrt-Devel] [PATCH 1/3] kernel: trelay: handle netdevice events correctly

Ali MJ Al-Nasrawy alimjalnasrawy at gmail.com
Wed Sep 25 10:47:11 EDT 2019


Since v3.11, netdevice notification data are of type
"struct netdev_notifier_info". Handle it as such!

This should fix a critical bug in which devices are unable get released
because trelay does not release resources in response to UNREGISTER
event spamming the log with something like:

unregister_netdevice: waiting for eth0.1 to become free. Usage count = 1

Signed-off-by: Ali MJ Al-Nasrawy <alimjalnasrawy at gmail.com>
---
 package/kernel/trelay/src/trelay.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/kernel/trelay/src/trelay.c b/package/kernel/trelay/src/trelay.c
index 581a5cfd2f..6d9d9cc14b 100644
--- a/package/kernel/trelay/src/trelay.c
+++ b/package/kernel/trelay/src/trelay.c
@@ -86,7 +86,7 @@ static struct trelay *trelay_find(struct net_device *dev)
 static int tr_device_event(struct notifier_block *unused, unsigned long event,
 			   void *ptr)
 {
-	struct net_device *dev = ptr;
+	struct net_device *dev = ((struct netdev_notifier_info *)ptr)->dev;
 	struct trelay *tr;
 
 	if (event != NETDEV_UNREGISTER)
-- 
2.23.0


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list