diff options
author | Ying Xue <ying.xue@windriver.com> | 2018-02-14 00:38:02 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-02-14 14:46:32 -0500 |
commit | 07ffb22357323c7189921935b24d68018e1a2b68 (patch) | |
tree | 4796d5272447525d78a9ebee655314748967360e /net | |
parent | 93532bb1d436984dac60c92d1a93eecda4fecb29 (diff) |
tipc: Introduce __tipc_nl_media_set
Introduce __tipc_nl_media_set() which doesn't hold RTNL lock.
Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-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 f92c9c58d686..3e3dce3d4c63 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -1130,7 +1130,7 @@ err_out: | |||
1130 | return err; | 1130 | return err; |
1131 | } | 1131 | } |
1132 | 1132 | ||
1133 | int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) | 1133 | int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) |
1134 | { | 1134 | { |
1135 | int err; | 1135 | int err; |
1136 | char *name; | 1136 | char *name; |
@@ -1148,22 +1148,17 @@ int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) | |||
1148 | return -EINVAL; | 1148 | return -EINVAL; |
1149 | name = nla_data(attrs[TIPC_NLA_MEDIA_NAME]); | 1149 | name = nla_data(attrs[TIPC_NLA_MEDIA_NAME]); |
1150 | 1150 | ||
1151 | rtnl_lock(); | ||
1152 | m = tipc_media_find(name); | 1151 | m = tipc_media_find(name); |
1153 | if (!m) { | 1152 | if (!m) |
1154 | rtnl_unlock(); | ||
1155 | return -EINVAL; | 1153 | return -EINVAL; |
1156 | } | ||
1157 | 1154 | ||
1158 | if (attrs[TIPC_NLA_MEDIA_PROP]) { | 1155 | if (attrs[TIPC_NLA_MEDIA_PROP]) { |
1159 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; | 1156 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; |
1160 | 1157 | ||
1161 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_MEDIA_PROP], | 1158 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_MEDIA_PROP], |
1162 | props); | 1159 | props); |
1163 | if (err) { | 1160 | if (err) |
1164 | rtnl_unlock(); | ||
1165 | return err; | 1161 | return err; |
1166 | } | ||
1167 | 1162 | ||
1168 | if (props[TIPC_NLA_PROP_TOL]) | 1163 | if (props[TIPC_NLA_PROP_TOL]) |
1169 | m->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); | 1164 | m->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); |
@@ -1172,7 +1167,17 @@ int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) | |||
1172 | if (props[TIPC_NLA_PROP_WIN]) | 1167 | if (props[TIPC_NLA_PROP_WIN]) |
1173 | m->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); | 1168 | m->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
1174 | } | 1169 | } |
1175 | rtnl_unlock(); | ||
1176 | 1170 | ||
1177 | return 0; | 1171 | return 0; |
1178 | } | 1172 | } |
1173 | |||
1174 | int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) | ||
1175 | { | ||
1176 | int err; | ||
1177 | |||
1178 | rtnl_lock(); | ||
1179 | err = __tipc_nl_media_set(skb, info); | ||
1180 | rtnl_unlock(); | ||
1181 | |||
1182 | return err; | ||
1183 | } | ||
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index cc0f529a56b5..a53613d95bc9 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -200,6 +200,7 @@ int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info); | |||
200 | 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); |
201 | int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info); | 201 | int tipc_nl_media_get(struct sk_buff *skb, struct genl_info *info); |
202 | int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info); | 202 | int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info); |
203 | int __tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info); | ||
203 | 204 | ||
204 | int tipc_media_set_priority(const char *name, u32 new_value); | 205 | int tipc_media_set_priority(const char *name, u32 new_value); |
205 | int tipc_media_set_window(const char *name, u32 new_value); | 206 | int tipc_media_set_window(const char *name, u32 new_value); |