summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPravin B Shelar <pshelar@nicira.com>2013-08-23 12:45:04 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-09-14 06:54:55 -0700
commita8077ef001460c41bc0509b096d3d342002c4d9b (patch)
treef1d251921694454c55a89e7302d6807b8a95d104 /net
parente307a8acf8c075261f8110b7088f20d2f7206f56 (diff)
downloadlinux-3.10-a8077ef001460c41bc0509b096d3d342002c4d9b.tar.gz
linux-3.10-a8077ef001460c41bc0509b096d3d342002c4d9b.tar.bz2
linux-3.10-a8077ef001460c41bc0509b096d3d342002c4d9b.zip
genl: Hold reference on correct module while netlink-dump.
[ Upstream commit 33c6b1f6b154894321f5734e50c66621e9134e7e ] netlink dump operations take module as parameter to hold reference for entire netlink dump duration. Currently it holds ref only on genl module which is not correct when we use ops registered to genl from another module. Following patch adds module pointer to genl_ops so that netlink can hold ref count on it. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> CC: Jesse Gross <jesse@nicira.com> CC: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/netlink/genetlink.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index 8ee0b4506be..393f17eea1a 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -364,7 +364,7 @@ int genl_unregister_ops(struct genl_family *family, struct genl_ops *ops)
EXPORT_SYMBOL(genl_unregister_ops);
/**
- * genl_register_family - register a generic netlink family
+ * __genl_register_family - register a generic netlink family
* @family: generic netlink family
*
* Registers the specified family after validating it first. Only one
@@ -374,7 +374,7 @@ EXPORT_SYMBOL(genl_unregister_ops);
*
* Return 0 on success or a negative error code.
*/
-int genl_register_family(struct genl_family *family)
+int __genl_register_family(struct genl_family *family)
{
int err = -EINVAL;
@@ -430,10 +430,10 @@ errout_locked:
errout:
return err;
}
-EXPORT_SYMBOL(genl_register_family);
+EXPORT_SYMBOL(__genl_register_family);
/**
- * genl_register_family_with_ops - register a generic netlink family
+ * __genl_register_family_with_ops - register a generic netlink family
* @family: generic netlink family
* @ops: operations to be registered
* @n_ops: number of elements to register
@@ -457,12 +457,12 @@ EXPORT_SYMBOL(genl_register_family);
*
* Return 0 on success or a negative error code.
*/
-int genl_register_family_with_ops(struct genl_family *family,
+int __genl_register_family_with_ops(struct genl_family *family,
struct genl_ops *ops, size_t n_ops)
{
int err, i;
- err = genl_register_family(family);
+ err = __genl_register_family(family);
if (err)
return err;
@@ -476,7 +476,7 @@ err_out:
genl_unregister_family(family);
return err;
}
-EXPORT_SYMBOL(genl_register_family_with_ops);
+EXPORT_SYMBOL(__genl_register_family_with_ops);
/**
* genl_unregister_family - unregister generic netlink family
@@ -603,22 +603,24 @@ static int genl_family_rcv_msg(struct genl_family *family,
if (!family->parallel_ops) {
struct netlink_dump_control c = {
+ .module = family->module,
.data = ops,
.dump = genl_lock_dumpit,
.done = genl_lock_done,
};
genl_unlock();
- rc = netlink_dump_start(net->genl_sock, skb, nlh, &c);
+ rc = __netlink_dump_start(net->genl_sock, skb, nlh, &c);
genl_lock();
} else {
struct netlink_dump_control c = {
+ .module = family->module,
.dump = ops->dumpit,
.done = ops->done,
};
- rc = netlink_dump_start(net->genl_sock, skb, nlh, &c);
+ rc = __netlink_dump_start(net->genl_sock, skb, nlh, &c);
}
return rc;