diff options
| author | Rob Herring <robh@kernel.org> | 2018-03-08 10:21:07 -0500 |
|---|---|---|
| committer | Rob Herring <robh@kernel.org> | 2018-03-08 10:21:07 -0500 |
| commit | c679fa6e3aaa5c58fc514b5b88cfa82774b8d390 (patch) | |
| tree | 0c10b339368bd1795152a66a4e245e6f654fb3ec /net/tipc | |
| parent | bdb7013df910681f84eff27b07791d4c160cb76f (diff) | |
| parent | 4fd98e374fd377ae0458a9dc44aa779cf9631ddd (diff) | |
Merge branch 'dtc-update' into dt/next
Diffstat (limited to 'net/tipc')
| -rw-r--r-- | net/tipc/bearer.c | 82 | ||||
| -rw-r--r-- | net/tipc/bearer.h | 4 | ||||
| -rw-r--r-- | net/tipc/net.c | 15 | ||||
| -rw-r--r-- | net/tipc/net.h | 1 | ||||
| -rw-r--r-- | net/tipc/netlink_compat.c | 43 |
5 files changed, 91 insertions, 54 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: | |||
| 813 | return err; | 813 | return err; |
| 814 | } | 814 | } |
| 815 | 815 | ||
| 816 | int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) | 816 | int __tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) |
| 817 | { | 817 | { |
| 818 | int err; | 818 | int err; |
| 819 | char *name; | 819 | char *name; |
| @@ -835,20 +835,27 @@ int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) | |||
| 835 | 835 | ||
| 836 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); | 836 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); |
| 837 | 837 | ||
| 838 | rtnl_lock(); | ||
| 839 | bearer = tipc_bearer_find(net, name); | 838 | bearer = tipc_bearer_find(net, name); |
| 840 | if (!bearer) { | 839 | if (!bearer) |
| 841 | rtnl_unlock(); | ||
| 842 | return -EINVAL; | 840 | return -EINVAL; |
| 843 | } | ||
| 844 | 841 | ||
| 845 | bearer_disable(net, bearer); | 842 | bearer_disable(net, bearer); |
| 846 | rtnl_unlock(); | ||
| 847 | 843 | ||
| 848 | return 0; | 844 | return 0; |
| 849 | } | 845 | } |
| 850 | 846 | ||
| 851 | int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) | 847 | int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) |
| 848 | { | ||
| 849 | int err; | ||
| 850 | |||
| 851 | rtnl_lock(); | ||
| 852 | err = __tipc_nl_bearer_disable(skb, info); | ||
| 853 | rtnl_unlock(); | ||
| 854 | |||
| 855 | return err; | ||
| 856 | } | ||
| 857 | |||
| 858 | int __tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) | ||
| 852 | { | 859 | { |
| 853 | int err; | 860 | int err; |
| 854 | char *bearer; | 861 | char *bearer; |
| @@ -890,15 +897,18 @@ int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) | |||
| 890 | prio = nla_get_u32(props[TIPC_NLA_PROP_PRIO]); | 897 | prio = nla_get_u32(props[TIPC_NLA_PROP_PRIO]); |
| 891 | } | 898 | } |
| 892 | 899 | ||
| 900 | return tipc_enable_bearer(net, bearer, domain, prio, attrs); | ||
| 901 | } | ||
| 902 | |||
| 903 | int tipc_nl_bearer_enable(struct sk_buff *skb, struct genl_info *info) | ||
| 904 | { | ||
| 905 | int err; | ||
| 906 | |||
| 893 | rtnl_lock(); | 907 | rtnl_lock(); |
| 894 | err = tipc_enable_bearer(net, bearer, domain, prio, attrs); | 908 | err = __tipc_nl_bearer_enable(skb, info); |
| 895 | if (err) { | ||
| 896 | rtnl_unlock(); | ||
| 897 | return err; | ||
| 898 | } | ||
| 899 | rtnl_unlock(); | 909 | rtnl_unlock(); |
| 900 | 910 | ||
| 901 | return 0; | 911 | return err; |
| 902 | } | 912 | } |
| 903 | 913 | ||
| 904 | int tipc_nl_bearer_add(struct sk_buff *skb, struct genl_info *info) | 914 | 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) | |||
| 944 | return 0; | 954 | return 0; |
| 945 | } | 955 | } |
| 946 | 956 | ||
| 947 | 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) |
| 948 | { | 958 | { |
| 949 | int err; | 959 | int err; |
| 950 | char *name; | 960 | char *name; |
| @@ -965,22 +975,17 @@ int tipc_nl_bearer_set(struct sk_buff *skb, struct genl_info *info) | |||
| 965 | return -EINVAL; | 975 | return -EINVAL; |
| 966 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); | 976 | name = nla_data(attrs[TIPC_NLA_BEARER_NAME]); |
| 967 | 977 | ||
| 968 | rtnl_lock(); | ||
| 969 | b = tipc_bearer_find(net, name); | 978 | b = tipc_bearer_find(net, name); |
| 970 | if (!b) { | 979 | if (!b) |
| 971 | rtnl_unlock(); | ||
| 972 | return -EINVAL; | 980 | return -EINVAL; |
| 973 | } | ||
| 974 | 981 | ||
| 975 | if (attrs[TIPC_NLA_BEARER_PROP]) { | 982 | if (attrs[TIPC_NLA_BEARER_PROP]) { |
| 976 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; | 983 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; |
| 977 | 984 | ||
| 978 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_BEARER_PROP], | 985 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_BEARER_PROP], |
| 979 | props); | 986 | props); |
| 980 | if (err) { | 987 | if (err) |
| 981 | rtnl_unlock(); | ||
| 982 | return err; | 988 | return err; |
| 983 | } | ||
| 984 | 989 | ||
| 985 | if (props[TIPC_NLA_PROP_TOL]) | 990 | if (props[TIPC_NLA_PROP_TOL]) |
| 986 | b->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); | 991 | 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) | |||
| 989 | if (props[TIPC_NLA_PROP_WIN]) | 994 | if (props[TIPC_NLA_PROP_WIN]) |
| 990 | b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); | 995 | b->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
| 991 | } | 996 | } |
| 992 | rtnl_unlock(); | ||
| 993 | 997 | ||
| 994 | return 0; | 998 | return 0; |
| 995 | } | 999 | } |
| 996 | 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 | |||
| 997 | static int __tipc_nl_add_media(struct tipc_nl_msg *msg, | 1012 | static int __tipc_nl_add_media(struct tipc_nl_msg *msg, |
| 998 | struct tipc_media *media, int nlflags) | 1013 | struct tipc_media *media, int nlflags) |
| 999 | { | 1014 | { |
| @@ -1115,7 +1130,7 @@ err_out: | |||
| 1115 | return err; | 1130 | return err; |
| 1116 | } | 1131 | } |
| 1117 | 1132 | ||
| 1118 | 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) |
| 1119 | { | 1134 | { |
| 1120 | int err; | 1135 | int err; |
| 1121 | char *name; | 1136 | char *name; |
| @@ -1133,22 +1148,17 @@ int tipc_nl_media_set(struct sk_buff *skb, struct genl_info *info) | |||
| 1133 | return -EINVAL; | 1148 | return -EINVAL; |
| 1134 | name = nla_data(attrs[TIPC_NLA_MEDIA_NAME]); | 1149 | name = nla_data(attrs[TIPC_NLA_MEDIA_NAME]); |
| 1135 | 1150 | ||
| 1136 | rtnl_lock(); | ||
| 1137 | m = tipc_media_find(name); | 1151 | m = tipc_media_find(name); |
| 1138 | if (!m) { | 1152 | if (!m) |
| 1139 | rtnl_unlock(); | ||
| 1140 | return -EINVAL; | 1153 | return -EINVAL; |
| 1141 | } | ||
| 1142 | 1154 | ||
| 1143 | if (attrs[TIPC_NLA_MEDIA_PROP]) { | 1155 | if (attrs[TIPC_NLA_MEDIA_PROP]) { |
| 1144 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; | 1156 | struct nlattr *props[TIPC_NLA_PROP_MAX + 1]; |
| 1145 | 1157 | ||
| 1146 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_MEDIA_PROP], | 1158 | err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_MEDIA_PROP], |
| 1147 | props); | 1159 | props); |
| 1148 | if (err) { | 1160 | if (err) |
| 1149 | rtnl_unlock(); | ||
| 1150 | return err; | 1161 | return err; |
| 1151 | } | ||
| 1152 | 1162 | ||
| 1153 | if (props[TIPC_NLA_PROP_TOL]) | 1163 | if (props[TIPC_NLA_PROP_TOL]) |
| 1154 | m->tolerance = nla_get_u32(props[TIPC_NLA_PROP_TOL]); | 1164 | 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) | |||
| 1157 | if (props[TIPC_NLA_PROP_WIN]) | 1167 | if (props[TIPC_NLA_PROP_WIN]) |
| 1158 | m->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); | 1168 | m->window = nla_get_u32(props[TIPC_NLA_PROP_WIN]); |
| 1159 | } | 1169 | } |
| 1160 | rtnl_unlock(); | ||
| 1161 | 1170 | ||
| 1162 | return 0; | 1171 | return 0; |
| 1163 | } | 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(); | ||
