diff options
Diffstat (limited to 'net/tipc/bearer.c')
| -rw-r--r-- | net/tipc/bearer.c | 82 | 
1 files changed, 51 insertions, 31 deletions
| diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index c8001471da6c..3e3dce3d4c63 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c @@ -813,7 +813,7 @@ err_out:  	return err;  } -int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) +int __tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info)  {  	int err;  	char *name; @@ -835,20 +835,27 @@ int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info)  	name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); -	rtnl_lock();  	bearer = tipc_bearer_find(net, name); -	if (!bearer) { -		rtnl_unlock(); +	if (!bearer)  		return -EINVAL; -	}  	bearer_disable(net, bearer); -	rtnl_unlock();  	return 0;  } -int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) +int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) +{ +	int err; + +	rtnl_lock(); +	err = __tipc_nl_bearer_disable(skb, info); +	rtnl_unlock(); + +	return err; +} + +int __tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info)  {  	int err;  	char *bearer; @@ -890,15 +897,18 @@ int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info)  			prio = nla_get_u32(props[TIPC_NLA_PROP_PRIO]);  	} +	return tipc_enable_bearer(net, bearer, domain, prio, attrs); +} + +int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) +{ +	int err; +  	rtnl_lock(); -	err = tipc_enable_bearer(net, bearer, domain, prio, attrs); -	if (err) { -		rtnl_unlock(); -		return err; -	} +	err = __tipc_nl_bearer_enable(skb, info);  	rtnl_unlock(); -	return 0; +	return err;  }  int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info) @@ -944,7 +954,7 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info)  	return 0;  } -int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) +int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)  {  	int err;  	char *name; @@ -965,22 +975,17 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)  		return -EINVAL;  	name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); -	rtnl_lock();  	b = tipc_bearer_find(net, name); -	if (!b) { -		rtnl_unlock(); +	if (!b)  		return -EINVAL; -	}  	if (attrs[TIPC_NLA_BEARER_PROP]) {  		struct nlattr *props[TIPC_NLA_PROP_MAX + 1];  		err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_BEARER_PROP],  					      props); -		if (err) { -			rtnl_unlock(); +		if (err)  			return err; -		}  		if (props[TIPC_NLA_PROP_TOL])  			b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); @@ -989,11 +994,21 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info)  		if (props[TIPC_NLA_PROP_WIN])  			b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]);  	} -	rtnl_unlock();  	return 0;  } +int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) +{ +	int err; + +	rtnl_lock(); +	err = __tipc_nl_bearer_set(skb, info); +	rtnl_unlock(); + +	return err; +} +  static int __tipc_nl_add_media(struct tipc_nl_msg *msg,  			       struct tipc_media *media, int nlflags)  { @@ -1115,7 +1130,7 @@ err_out:  	return err;  } -int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) +int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)  {  	int err;  	char *name; @@ -1133,22 +1148,17 @@ int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)  		return -EINVAL;  	name = nla_data(attrs[TIPC_NLA_MEDIA_NAME]); -	rtnl_lock();  	m = tipc_media_find(name); -	if (!m) { -		rtnl_unlock(); +	if (!m)  		return -EINVAL; -	}  	if (attrs[TIPC_NLA_MEDIA_PROP]) {  		struct nlattr *props[TIPC_NLA_PROP_MAX + 1];  		err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_MEDIA_PROP],  					      props); -		if (err) { -			rtnl_unlock(); +		if (err)  			return err; -		}  		if (props[TIPC_NLA_PROP_TOL])  			m->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); @@ -1157,7 +1167,17 @@ int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info)  		if (props[TIPC_NLA_PROP_WIN])  			m->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]);  	} -	rtnl_unlock();  	return 0;  } + +int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) +{ +	int err; + +	rtnl_lock(); +	err = __tipc_nl_media_set(skb, info); +	rtnl_unlock(); + +	return err; +} |