]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/net/wan/dlci.c
dlci: validate the net device in dlci_del()
[karo-tx-linux.git] / drivers / net / wan / dlci.c
index 1f6e0538c716af3d2392a7178c3490873d816ebb..6a8a382c5f4c071f070c88f618296b1b9d6624df 100644 (file)
@@ -384,6 +384,7 @@ static int dlci_del(struct dlci_add *dlci)
        struct frad_local       *flp;
        struct net_device       *master, *slave;
        int                     err;
+       bool                    found = false;
 
        rtnl_lock();
 
@@ -394,6 +395,17 @@ static int dlci_del(struct dlci_add *dlci)
                goto out;
        }
 
+       list_for_each_entry(dlp, &dlci_devs, list) {
+               if (dlp->master == master) {
+                       found = true;
+                       break;
+               }
+       }
+       if (!found) {
+               err = -ENODEV;
+               goto out;
+       }
+
        if (netif_running(master)) {
                err = -EBUSY;
                goto out;