netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: pablo@netfilter.org
To: stable@vger.kernel.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/3] ipvs: fix oops in ip_vs_dst_event on rmmod
Date: Thu, 11 Oct 2012 12:17:36 +0200	[thread overview]
Message-ID: <1349950658-12548-2-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1349950658-12548-1-git-send-email-pablo@netfilter.org>

From: Julian Anastasov <ja@ssi.bg>

	After commit 39f618b4fd95ae243d940ec64c961009c74e3333 (3.4)
"ipvs: reset ipvs pointer in netns" we can oops in
ip_vs_dst_event on rmmod ip_vs because ip_vs_control_cleanup
is called after the ipvs_core_ops subsys is unregistered and
net->ipvs is NULL. Fix it by exiting early from ip_vs_dst_event
if ipvs is NULL. It is safe because all services and dests
for the net are already freed.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/ipvs/ip_vs_ctl.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index d43e3c1..84444dd 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -1521,11 +1521,12 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
 {
 	struct net_device *dev = ptr;
 	struct net *net = dev_net(dev);
+	struct netns_ipvs *ipvs = net_ipvs(net);
 	struct ip_vs_service *svc;
 	struct ip_vs_dest *dest;
 	unsigned int idx;
 
-	if (event != NETDEV_UNREGISTER)
+	if (event != NETDEV_UNREGISTER || !ipvs)
 		return NOTIFY_DONE;
 	IP_VS_DBG(3, "%s() dev=%s\n", __func__, dev->name);
 	EnterFunction(2);
@@ -1551,7 +1552,7 @@ static int ip_vs_dst_event(struct notifier_block *this, unsigned long event,
 		}
 	}
 
-	list_for_each_entry(dest, &net_ipvs(net)->dest_trash, n_list) {
+	list_for_each_entry(dest, &ipvs->dest_trash, n_list) {
 		__ip_vs_dev_reset(dest, dev);
 	}
 	mutex_unlock(&__ip_vs_mutex);
-- 
1.7.10.4


  reply	other threads:[~2012-10-11 10:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11 10:17 [PATCH] Netfilter/IPVS updates for stable 3.4 onwards pablo
2012-10-11 10:17 ` pablo [this message]
2012-10-11 10:17 ` [PATCH 2/3] netfilter: nf_conntrack: fix racy timer handling with reliable events pablo
2012-10-11 10:17 ` [PATCH 3/3] netfilter: ipset: timeout fixing bug broke SET target special timeout value pablo
2012-10-15 23:22   ` Greg KH
2012-10-15 23:27     ` Greg KH
2012-10-15 23:40       ` Greg KH
2012-10-16  9:36         ` Pablo Neira Ayuso
2012-10-16 16:32           ` Greg KH
2012-10-17  2:09           ` Ben Hutchings
2012-10-11 22:20 ` [PATCH] Netfilter/IPVS updates for stable 3.4 onwards David Miller
2012-10-15 23:22   ` Greg KH
2012-10-15 23:18 ` Greg KH
2012-10-16  9:04   ` Pablo Neira Ayuso
2012-10-16 14:38     ` Pablo Neira Ayuso
2012-10-16 16:31       ` Greg KH
2012-10-16 21:04         ` Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2012-10-11 10:07 pablo
2012-10-11 10:07 ` [PATCH 1/3] ipvs: fix oops in ip_vs_dst_event on rmmod pablo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349950658-12548-2-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).