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-Tag: v1.0.0~259^2~181 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a91f96d70870e2ba5324d4b5cea5aa9fe874ebee;p=sliver-openvswitch.git 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 a7a211cd0..21a6717c2 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)