aboutsummaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-01-13 00:21:27 -0500
committerDavid S. Miller <davem@davemloft.net>2016-01-13 00:21:27 -0500
commitddb5388ffd0ad75d07e7b78181a0b579824ba6f0 (patch)
treebe1e2bd103c69d7bbace3fffd97bc3d714bbc3d7 /net/netlink
parentccdf6ce6a8dba374668ae9b4d763e19903611c38 (diff)
parent67990608c8b95d2b8ccc29932376ae73d5818727 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/af_netlink.c4
-rw-r--r--net/netlink/genetlink.c16
2 files changed, 20 insertions, 0 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 59651af8cc27..81dc1bb6e016 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -2915,6 +2915,7 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
2915 2915
2916 cb = &nlk->cb; 2916 cb = &nlk->cb;
2917 memset(cb, 0, sizeof(*cb)); 2917 memset(cb, 0, sizeof(*cb));
2918 cb->start = control->start;
2918 cb->dump = control->dump; 2919 cb->dump = control->dump;
2919 cb->done = control->done; 2920 cb->done = control->done;
2920 cb->nlh = nlh; 2921 cb->nlh = nlh;
@@ -2927,6 +2928,9 @@ int __netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
2927 2928
2928 mutex_unlock(nlk->cb_mutex); 2929 mutex_unlock(nlk->cb_mutex);
2929 2930
2931 if (cb->start)
2932 cb->start(cb);
2933
2930 ret = netlink_dump(sk); 2934 ret = netlink_dump(sk);
2931 sock_put(sk); 2935 sock_put(sk);
2932 2936
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index a992083c0a64..d3f6b063467b 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -513,6 +513,20 @@ void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
513} 513}
514EXPORT_SYMBOL(genlmsg_put); 514EXPORT_SYMBOL(genlmsg_put);
515 515
516static int genl_lock_start(struct netlink_callback *cb)
517{
518 /* our ops are always const - netlink API doesn't propagate that */
519 const struct genl_ops *ops = cb->data;
520 int rc = 0;
521
522 if (ops->start) {
523 genl_lock();
524 rc = ops->start(cb);
525 genl_unlock();
526 }
527 return rc;
528}
529
516static int genl_lock_dumpit(struct sk_buff *skb, struct netlink_callback *cb) 530static int genl_lock_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
517{ 531{
518 /* our ops are always const - netlink API doesn't propagate that */ 532 /* our ops are always const - netlink API doesn't propagate that */
@@ -577,6 +591,7 @@ static int genl_family_rcv_msg(struct genl_family *family,
577 .module = family->module, 591 .module = family->module,
578 /* we have const, but the netlink API doesn't */ 592 /* we have const, but the netlink API doesn't */
579 .data = (void *)ops, 593 .data = (void *)ops,
594 .start = genl_lock_start,
580 .dump = genl_lock_dumpit, 595 .dump = genl_lock_dumpit,
581 .done = genl_lock_done, 596 .done = genl_lock_done,
582 }; 597 };
@@ -588,6 +603,7 @@ static int genl_family_rcv_msg(struct genl_family *family,
588 } else { 603 } else {
589 struct netlink_dump_control c = { 604 struct netlink_dump_control c = {
590 .module = family->module, 605 .module = family->module,
606 .start = ops->start,
591 .dump = ops->dumpit, 607 .dump = ops->dumpit,
592 .done = ops->done, 608 .done = ops->done,
593 }; 609 };