From: Jesse Gross Date: Mon, 8 Feb 2010 19:52:20 +0000 (-0500) Subject: gre: Fix use after free in netns compatibility layer. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a91f96d70870e2ba5324d4b5cea5aa9fe874ebee;p=openvswitch gre: Fix use after free in netns compatibility layer. 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. --- diff --git a/datapath/linux-2.6/compat-2.6/net_namespace-ip_gre.c b/datapath/linux-2.6/compat-2.6/net_namespace-ip_gre.c index a7a211cd..21a6717c 100644 --- a/datapath/linux-2.6/compat-2.6/net_namespace-ip_gre.c +++ b/datapath/linux-2.6/compat-2.6/net_namespace-ip_gre.c @@ -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)