gre: Fix use after free in netns compatibility layer.
authorJesse Gross <jesse@nicira.com>
Mon, 8 Feb 2010 19:52:20 +0000 (14:52 -0500)
committerJesse Gross <jesse@nicira.com>
Mon, 8 Feb 2010 19:54:43 +0000 (14:54 -0500)
The newly updated network namespace compatibility layer contained
an issue in the pernet automatic storage allocation feature that
prematurely freed memory.  This caused an OOPS if the module was
unloaded.

datapath/linux-2.6/compat-2.6/net_namespace-ip_gre.c

index a7a211c..21a6717 100644 (file)
@@ -43,13 +43,13 @@ static int device_init_net(struct net *net)
 
 static void device_exit_net(struct net *net)
 {
+       if (dev_ops->exit)
+               dev_ops->exit(net);
+
        if (dev_ops->id && dev_ops->size) {
                int id = *dev_ops->id;
                kfree(rpl_net_generic(net, id));
        }
-
-       if (dev_ops->exit)
-               return dev_ops->exit(net);
 }
 
 int rpl_register_pernet_device(struct extended_pernet_operations *ops)