static void cleanup(struct wdm_device *desc)
 {
-       spin_lock(&wdm_device_list_lock);
-       list_del(&desc->device_list);
-       spin_unlock(&wdm_device_list_lock);
        kfree(desc->sbuf);
        kfree(desc->inbuf);
        kfree(desc->orq);
 out:
        return rv;
 err:
+       spin_lock(&wdm_device_list_lock);
+       list_del(&desc->device_list);
+       spin_unlock(&wdm_device_list_lock);
        cleanup(desc);
        return rv;
 }
        cancel_work_sync(&desc->rxwork);
        mutex_unlock(&desc->wlock);
        mutex_unlock(&desc->rlock);
+
+       /* the desc->intf pointer used as list key is now invalid */
+       spin_lock(&wdm_device_list_lock);
+       list_del(&desc->device_list);
+       spin_unlock(&wdm_device_list_lock);
+
        if (!desc->count)
                cleanup(desc);
        else