trelay: handle netdevice events correctly
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>
Wed, 25 Sep 2019 14:47:11 +0000 (17:47 +0300)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 12 Oct 2019 21:51:29 +0000 (23:51 +0200)
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@gmail.com>
package/kernel/trelay/src/trelay.c

index 581a5cfd2fa4d1ffbab8f41c76b2c7bd6b42e93b..d09dc072464ca2c350a35f5a115fb90c9f85ed9f 100644 (file)
@@ -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)
 {
 static int tr_device_event(struct notifier_block *unused, unsigned long event,
                           void *ptr)
 {
-       struct net_device *dev = ptr;
+       struct net_device *dev = netdev_notifier_info_to_dev(ptr);
        struct trelay *tr;
 
        if (event != NETDEV_UNREGISTER)
        struct trelay *tr;
 
        if (event != NETDEV_UNREGISTER)