Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Nicolas Dichtel and committed by
David S. Miller
f2f67390 46c264da

+13 -12
+9 -8
net/tipc/bearer.c
··· 591 591 592 592 /* Caller should hold rtnl_lock to protect the bearer */ 593 593 static 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 596 void *hdr; 597 597 struct nlattr *attrs; 598 598 struct nlattr *prop; 599 599 600 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 602 if (!hdr) 603 603 return -EMSGSIZE; 604 604 ··· 657 657 if (!bearer) 658 658 continue; 659 659 660 - err = __tipc_nl_add_bearer(&msg, bearer); 660 + err = __tipc_nl_add_bearer(&msg, bearer, NLM_F_MULTI); 661 661 if (err) 662 662 break; 663 663 } ··· 705 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 709 if (err) 710 710 goto err_out; 711 711 rtnl_unlock(); ··· 857 857 } 858 858 859 859 static 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 862 void *hdr; 863 863 struct nlattr *attrs; 864 864 struct nlattr *prop; 865 865 866 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 868 if (!hdr) 869 869 return -EMSGSIZE; 870 870 ··· 916 916 917 917 rtnl_lock(); 918 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 921 if (err) 921 922 break; 922 923 } ··· 964 963 goto err_out; 965 964 } 966 965 967 - err = __tipc_nl_add_media(&msg, media); 966 + err = __tipc_nl_add_media(&msg, media, 0); 968 967 if (err) 969 968 goto err_out; 970 969 rtnl_unlock();
+4 -4
net/tipc/link.c
··· 2013 2013 2014 2014 /* Caller should hold appropriate locks to protect the link */ 2015 2015 static 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 2018 int err; 2019 2019 void *hdr; ··· 2022 2022 struct tipc_net *tn = net_generic(net, tipc_net_id); 2023 2023 2024 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 2026 if (!hdr) 2027 2027 return -EMSGSIZE; 2028 2028 ··· 2095 2095 if (!node->links[i]) 2096 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 2099 if (err) 2100 2100 return err; 2101 2101 } ··· 2209 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 2213 if (err) 2214 2214 goto err_out; 2215 2215