Patchwork nfnetlink: use rcu_assign_pointer in nfnetlink_subsys_unregister

login
register
mail settings
Submitter Gao feng
Date Oct. 8, 2013, 10:04 a.m.
Message ID <1381226648-10959-1-git-send-email-gaofeng@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/281390/
State Not Applicable
Headers show

Comments

Gao feng - Oct. 8, 2013, 10:04 a.m.
Though I don't face an oops, but it is more safer to
set table's subsys through rcu_assign_pointer.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
---
 net/netfilter/nfnetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 572d87d..3cd2fe6 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -78,7 +78,7 @@  EXPORT_SYMBOL_GPL(nfnetlink_subsys_register);
 int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n)
 {
 	nfnl_lock(n->subsys_id);
-	table[n->subsys_id].subsys = NULL;
+	rcu_assign_pointer(table[n->subsys_id].subsys, NULL);
 	nfnl_unlock(n->subsys_id);
 	synchronize_rcu();
 	return 0;