From a91f96d70870e2ba5324d4b5cea5aa9fe874ebee Mon Sep 17 00:00:00 2001 From: Jesse Gross Date: Mon, 8 Feb 2010 14:52:20 -0500 Subject: [PATCH] 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. --- datapath/linux-2.6/compat-2.6/net_namespace-ip_gre.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.43.0