summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNicolas Dichtel <nicolas.dichtel@6wind.com>2015-04-28 12:33:50 -0400
committerDavid S. Miller <davem@davemloft.net>2015-04-29 14:59:17 -0400
commitf2f67390a4b961dae83733732e96e1a394a53c4e (patch)
treea8b85b41d7129cd8f36581384ff24e993e822a80 /net
parent46c264daaaa569e24f8aba877d0fd8167c42a9a4 (diff)
tipc: remove wrong use of NLM_F_MULTI
NLM_F_MULTI must be used only when a NLMSG_DONE message is sent. In fact, it is sent only at the end of a dump. Libraries like libnl will wait forever for NLMSG_DONE. Fixes: 35b9dd7607f0 ("tipc: add bearer get/dump to new netlink api") Fixes: 7be57fc69184 ("tipc: add link get/dump to new netlink api") Fixes: 46f15c6794fb ("tipc: add media get/dump to new netlink api") CC: Richard Alpe <richard.alpe@ericsson.com> CC: Jon Maloy <jon.maloy@ericsson.com> CC: Ying Xue <ying.xue@windriver.com> CC: tipc-discussion@lists.sourceforge.net Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/bearer.c17
-rw-r--r--net/tipc/link.c8
2 files changed, 13 insertions, 12 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 3613e72e858e..70e3dacbf84a 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -591,14 +591,14 @@ void tipc_bearer_stop(struct net *net)
591 591
592/* Caller should hold rtnl_lock to protect the bearer */ 592/* Caller should hold rtnl_lock to protect the bearer */
593static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg, 593static int __tipc_nl_add_bearer(struct tipc_nl_msg *msg,
594 struct tipc_bearer *bearer) 594 struct tipc_bearer *bearer, int nlflags)
595{ 595{
596 void *hdr; 596 void *hdr;
597 struct nlattr *attrs; 597 struct nlattr *attrs;
598 struct nlattr *prop; 598 struct nlattr *prop;
599 599
600 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, 600 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family,
601 NLM_F_MULTI, TIPC_NL_BEARER_GET); 601 nlflags, TIPC_NL_BEARER_GET);
602 if (!hdr) 602 if (!hdr)
603 return -EMSGSIZE; 603 return -EMSGSIZE;
604 604
@@ -657,7 +657,7 @@ int tipc_nl_bearer_dump(struct sk_buff *skb, struct netlink_callback *cb)
657 if (!bearer) 657 if (!bearer)
658 continue; 658 continue;
659 659
660 err = __tipc_nl_add_bearer(&msg, bearer); 660 err = __tipc_nl_add_bearer(&msg, bearer, NLM_F_MULTI);
661 if (err) 661 if (err)
662 break; 662 break;
663 } 663 }
@@ -705,7 +705,7 @@ int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info)
705 goto err_out; 705 goto err_out;
706 } 706 }
707 707
708 err = __tipc_nl_add_bearer(&msg, bearer); 708 err = __tipc_nl_add_bearer(&msg, bearer, 0);
709 if (err) 709 if (err)
710 goto err_out; 710 goto err_out;
711 rtnl_unlock(); 711 rtnl_unlock();
@@ -857,14 +857,14 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)
857} 857}
858 858
859static int __tipc_nl_add_media(struct tipc_nl_msg *msg, 859static int __tipc_nl_add_media(struct tipc_nl_msg *msg,
860 struct tipc_media *media) 860 struct tipc_media *media, int nlflags)
861{ 861{
862 void *hdr; 862 void *hdr;
863 struct nlattr *attrs; 863 struct nlattr *attrs;
864 struct nlattr *prop; 864 struct nlattr *prop;
865 865
866 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, 866 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family,
867 NLM_F_MULTI, TIPC_NL_MEDIA_GET); 867 nlflags, TIPC_NL_MEDIA_GET);
868 if (!hdr) 868 if (!hdr)
869 return -EMSGSIZE; 869 return -EMSGSIZE;
870 870
@@ -916,7 +916,8 @@ int tipc_nl_media_dump(struct sk_buff *skb, struct netlink_callback *cb)
916 916
917 rtnl_lock(); 917 rtnl_lock();
918 for (; media_info_array[i] != NULL; i++) { 918 for (; media_info_array[i] != NULL; i++) {
919 err = __tipc_nl_add_media(&msg, media_info_array[i]); 919 err = __tipc_nl_add_media(&msg, media_info_array[i],
920 NLM_F_MULTI);
920 if (err) 921 if (err)
921 break; 922 break;
922 } 923 }
@@ -963,7 +964,7 @@ int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info)
963 goto err_out; 964 goto err_out;
964 } 965 }
965 966
966 err = __tipc_nl_add_media(&msg, media); 967 err = __tipc_nl_add_media(&msg, media, 0);
967 if (err) 968 if (err)
968 goto err_out; 969 goto err_out;
969 rtnl_unlock(); 970 rtnl_unlock();
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 57be6e6aff99..a11cc5e5e0ae 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -2013,7 +2013,7 @@ msg_full:
2013 2013
2014/* Caller should hold appropriate locks to protect the link */ 2014/* Caller should hold appropriate locks to protect the link */
2015static int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg, 2015static int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
2016 struct tipc_link *link) 2016 struct tipc_link *link, int nlflags)
2017{ 2017{
2018 int err; 2018 int err;
2019 void *hdr; 2019 void *hdr;
@@ -2022,7 +2022,7 @@ static int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
2022 struct tipc_net *tn = net_generic(net, tipc_net_id); 2022 struct tipc_net *tn = net_generic(net, tipc_net_id);
2023 2023
2024 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family, 2024 hdr = genlmsg_put(msg->skb, msg->portid, msg->seq, &tipc_genl_family,
2025 NLM_F_MULTI, TIPC_NL_LINK_GET); 2025 nlflags, TIPC_NL_LINK_GET);
2026 if (!hdr) 2026 if (!hdr)
2027 return -EMSGSIZE; 2027 return -EMSGSIZE;
2028 2028
@@ -2095,7 +2095,7 @@ static int __tipc_nl_add_node_links(struct net *net, struct tipc_nl_msg *msg,
2095 if (!node->links[i]) 2095 if (!node->links[i])
2096 continue; 2096 continue;
2097 2097
2098 err = __tipc_nl_add_link(net, msg, node->links[i]); 2098 err = __tipc_nl_add_link(net, msg, node->links[i], NLM_F_MULTI);
2099 if (err) 2099 if (err)
2100 return err; 2100 return err;
2101 } 2101 }
@@ -2209,7 +2209,7 @@ int tipc_nl_link_get(struct sk_buff *skb, struct genl_info *info)
2209 goto err_out; 2209 goto err_out;
2210 } 2210 }
2211 2211
2212 err = __tipc_nl_add_link(net, &msg, link); 2212 err = __tipc_nl_add_link(net, &msg, link, 0);
2213 if (err) 2213 if (err)
2214 goto err_out; 2214 goto err_out;
2215 2215