diff options
Diffstat (limited to 'net/tipc/node.c')
| -rw-r--r-- | net/tipc/node.c | 28 | 
1 files changed, 18 insertions, 10 deletions
| diff --git a/net/tipc/node.c b/net/tipc/node.c index c77dd2f3c589..f29549de9245 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -1950,6 +1950,7 @@ out:  int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)  {  	struct net *net = genl_info_net(info); +	struct nlattr *attrs[TIPC_NLA_LINK_MAX + 1];  	struct tipc_nl_msg msg;  	char *name;  	int err; @@ -1957,9 +1958,19 @@ int tipc_nl_node_get_link(struct sk_buff *skb, struct genl_info *info)  	msg.portid = info->snd_portid;  	msg.seq = info->snd_seq; -	if (!info->attrs[TIPC_NLA_LINK_NAME]) +	if (!info->attrs[TIPC_NLA_LINK])  		return -EINVAL; -	name = nla_data(info->attrs[TIPC_NLA_LINK_NAME]); + +	err = nla_parse_nested(attrs, TIPC_NLA_LINK_MAX, +			       info->attrs[TIPC_NLA_LINK], +			       tipc_nl_link_policy, info->extack); +	if (err) +		return err; + +	if (!attrs[TIPC_NLA_LINK_NAME]) +		return -EINVAL; + +	name = nla_data(attrs[TIPC_NLA_LINK_NAME]);  	msg.skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);  	if (!msg.skb) @@ -2232,8 +2243,8 @@ int tipc_nl_node_dump_monitor(struct sk_buff *skb, struct netlink_callback *cb)  	struct net *net = sock_net(skb->sk);  	u32 prev_bearer = cb->args[0];  	struct tipc_nl_msg msg; +	int bearer_id;  	int err; -	int i;  	if (prev_bearer == MAX_BEARERS)  		return 0; @@ -2243,16 +2254,13 @@ int tipc_nl_node_dump_monitor(struct sk_buff *skb, struct netlink_callback *cb)  	msg.seq = cb->nlh->nlmsg_seq;  	rtnl_lock(); -	for (i = prev_bearer; i < MAX_BEARERS; i++) { -		prev_bearer = i; -		err = __tipc_nl_add_monitor(net, &msg, prev_bearer); +	for (bearer_id = prev_bearer; bearer_id < MAX_BEARERS; bearer_id++) { +		err = __tipc_nl_add_monitor(net, &msg, bearer_id);  		if (err) -			goto out; +			break;  	} - -out:  	rtnl_unlock(); -	cb->args[0] = prev_bearer; +	cb->args[0] = bearer_id;  	return skb->len;  } |