diff options
author | Ying Xue <ying.xue@windriver.com> | 2018-02-14 00:38:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-14 14:46:32 -0500 |
commit | 93532bb1d436984dac60c92d1a93eecda4fecb29 (patch) | |
tree | 8b37f3a689d6cb74cd638e858ca16c47492e02b5 /net/tipc | |
parent | 45cf7edfbc07b2208d7b4a79d4a36aeddf16aefd (diff) |
tipc: Introduce __tipc_nl_bearer_set
Introduce __tipc_nl_bearer_set() which doesn't holding RTNL lock.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/bearer.c | 23 | ||||
-rw-r--r-- | net/tipc/bearer.h | 1 |
2 files changed, 15 insertions, 9 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index faf8fa033740..f92c9c58d686 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -954,7 +954,7 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info) | |||
954 | return 0; | 954 | return 0; |
955 | } | 955 | } |
956 | 956 | ||
957 | int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | 957 | int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) |
958 | { | 958 | { |
959 | int err; | 959 | int err; |
960 | char *name; | 960 | char *name; |
@@ -975,22 +975,17 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | |||
975 | return -EINVAL; | 975 | return -EINVAL; |
976 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); | 976 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); |
977 | 977 | ||
978 | rtnl_lock(); | ||
979 | b = tipc_bearer_find(net, name); | 978 | b = tipc_bearer_find(net, name); |
980 | if (!b) { | 979 | if (!b) |
981 | rtnl_unlock(); | ||
982 | return -EINVAL; | 980 | return -EINVAL; |
983 | } | ||
984 | 981 | ||
985 | if (attrs[TIPC_NLA_BEARER_PROP]) { | 982 | if (attrs[TIPC_NLA_BEARER_PROP]) { |
986 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; | 983 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; |
987 | 984 | ||
988 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_BEARER_PROP], | 985 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_BEARER_PROP], |
989 | props); | 986 | props); |
990 | if (err) { | 987 | if (err) |
991 | rtnl_unlock(); | ||
992 | return err; | 988 | return err; |
993 | } | ||
994 | 989 | ||
995 | if (props[TIPC_NLA_PROP_TOL]) | 990 | if (props[TIPC_NLA_PROP_TOL]) |
996 | b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); | 991 | b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); |
@@ -999,11 +994,21 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | |||
999 | if (props[TIPC_NLA_PROP_WIN]) | 994 | if (props[TIPC_NLA_PROP_WIN]) |
1000 | b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); | 995 | b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
1001 | } | 996 | } |
1002 | rtnl_unlock(); | ||
1003 | 997 | ||
1004 | return 0; | 998 | return 0; |
1005 | } | 999 | } |
1006 | 1000 | ||
1001 | int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | ||
1002 | { | ||
1003 | int err; | ||
1004 | |||
1005 | rtnl_lock(); | ||
1006 | err = __tipc_nl_bearer_set(skb, info); | ||
1007 | rtnl_unlock(); | ||
1008 | |||
1009 | return err; | ||
1010 | } | ||
1011 | |||
1007 | static int __tipc_nl_add_media(struct tipc_nl_msg *msg, | 1012 | static int __tipc_nl_add_media(struct tipc_nl_msg *msg, |
1008 | struct tipc_media *media, int nlflags) | 1013 | struct tipc_media *media, int nlflags) |
1009 | { | 1014 | { |
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index fc81150ca9c9..cc0f529a56b5 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -194,6 +194,7 @@ int __tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info); | |||
194 | int tipc_nl_bearer_dump(struct sk_buff *skb, struct netlink_callback *cb); | 194 | int tipc_nl_bearer_dump(struct sk_buff *skb, struct netlink_callback *cb); |
195 | int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info); | 195 | int tipc_nl_bearer_get(struct sk_buff *skb, struct genl_info *info); |
196 | int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info); | 196 | int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info); |
197 | int __tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info); | ||
197 | int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info); | 198 | int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info); |
198 | 199 | ||
199 | int tipc_nl_media_dump(struct sk_buff *skb, struct netlink_callback *cb); | 200 | int tipc_nl_media_dump(struct sk_buff *skb, struct netlink_callback *cb); |