diff options
author | David S. Miller <davem@davemloft.net> | 2015-02-27 18:18:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-02-27 18:18:52 -0500 |
commit | 721a57a02dfc81b6d63b93b8ca23be3004b61515 (patch) | |
tree | 6d5b3bdd02fd7586b54de631f806e76efcdbfb50 | |
parent | 247f6d0f8667fda408fbe0e503ab54a957be2ce5 (diff) | |
parent | d76a436d50d1ebce352e1815eaea79a254b2b24f (diff) |
Merge branch 'tipc-next'
Erik Hugne says:
====================
tipc: bug fix and some improvements
Most important is a fix for a nullptr exception that would occur when
name table subscriptions fail. The remaining patches are performance
improvements and cosmetic changes.
v2: remove unnecessary whitespace in patch #2
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/tipc/bearer.c | 2 | ||||
-rw-r--r-- | net/tipc/bearer.h | 5 | ||||
-rw-r--r-- | net/tipc/eth_media.c | 8 | ||||
-rw-r--r-- | net/tipc/ib_media.c | 2 | ||||
-rw-r--r-- | net/tipc/msg.h | 4 | ||||
-rw-r--r-- | net/tipc/name_distr.c | 2 | ||||
-rw-r--r-- | net/tipc/subscr.c | 23 |
7 files changed, 15 insertions, 31 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c index 48852c2dcc03..af6deeb397a8 100644 --- a/net/tipc/bearer.c +++ b/net/tipc/bearer.c | |||
@@ -742,7 +742,7 @@ int tipc_nl_bearer_disable(struct sk_buff *skb, struct genl_info *info) | |||
742 | return -EINVAL; | 742 | return -EINVAL; |
743 | } | 743 | } |
744 | 744 | ||
745 | bearer_disable(net, bearer, false); | 745 | bearer_disable(net, bearer, true); |
746 | rtnl_unlock(); | 746 | rtnl_unlock(); |
747 | 747 | ||
748 | return 0; | 748 | return 0; |
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 6b17795ff8bc..097aff08ad5b 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h | |||
@@ -50,8 +50,9 @@ | |||
50 | * - the field's actual content and length is defined per media | 50 | * - the field's actual content and length is defined per media |
51 | * - remaining unused bytes in the field are set to zero | 51 | * - remaining unused bytes in the field are set to zero |
52 | */ | 52 | */ |
53 | #define TIPC_MEDIA_ADDR_SIZE 32 | 53 | #define TIPC_MEDIA_INFO_SIZE 32 |
54 | #define TIPC_MEDIA_TYPE_OFFSET 3 | 54 | #define TIPC_MEDIA_TYPE_OFFSET 3 |
55 | #define TIPC_MEDIA_ADDR_OFFSET 4 | ||
55 | 56 | ||
56 | /* | 57 | /* |
57 | * Identifiers of supported TIPC media types | 58 | * Identifiers of supported TIPC media types |
@@ -76,7 +77,7 @@ struct tipc_node_map { | |||
76 | * @broadcast: non-zero if address is a broadcast address | 77 | * @broadcast: non-zero if address is a broadcast address |
77 | */ | 78 | */ |
78 | struct tipc_media_addr { | 79 | struct tipc_media_addr { |
79 | u8 value[TIPC_MEDIA_ADDR_SIZE]; | 80 | u8 value[TIPC_MEDIA_INFO_SIZE]; |
80 | u8 media_id; | 81 | u8 media_id; |
81 | u8 broadcast; | 82 | u8 broadcast; |
82 | }; | 83 | }; |
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 5e1426f1751f..f69a2fde9f4a 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c | |||
@@ -37,8 +37,6 @@ | |||
37 | #include "core.h" | 37 | #include "core.h" |
38 | #include "bearer.h" | 38 | #include "bearer.h" |
39 | 39 | ||
40 | #define ETH_ADDR_OFFSET 4 /* MAC addr position inside address field */ | ||
41 | |||
42 | /* Convert Ethernet address (media address format) to string */ | 40 | /* Convert Ethernet address (media address format) to string */ |
43 | static int tipc_eth_addr2str(struct tipc_media_addr *addr, | 41 | static int tipc_eth_addr2str(struct tipc_media_addr *addr, |
44 | char *strbuf, int bufsz) | 42 | char *strbuf, int bufsz) |
@@ -53,9 +51,9 @@ static int tipc_eth_addr2str(struct tipc_media_addr *addr, | |||
53 | /* Convert from media address format to discovery message addr format */ | 51 | /* Convert from media address format to discovery message addr format */ |
54 | static int tipc_eth_addr2msg(char *msg, struct tipc_media_addr *addr) | 52 | static int tipc_eth_addr2msg(char *msg, struct tipc_media_addr *addr) |
55 | { | 53 | { |
56 | memset(msg, 0, TIPC_MEDIA_ADDR_SIZE); | 54 | memset(msg, 0, TIPC_MEDIA_INFO_SIZE); |
57 | msg[TIPC_MEDIA_TYPE_OFFSET] = TIPC_MEDIA_TYPE_ETH; | 55 | msg[TIPC_MEDIA_TYPE_OFFSET] = TIPC_MEDIA_TYPE_ETH; |
58 | memcpy(msg + ETH_ADDR_OFFSET, addr->value, ETH_ALEN); | 56 | memcpy(msg + TIPC_MEDIA_ADDR_OFFSET, addr->value, ETH_ALEN); |
59 | return 0; | 57 | return 0; |
60 | } | 58 | } |
61 | 59 | ||
@@ -79,7 +77,7 @@ static int tipc_eth_msg2addr(struct tipc_bearer *b, | |||
79 | char *msg) | 77 | char *msg) |
80 | { | 78 | { |
81 | /* Skip past preamble: */ | 79 | /* Skip past preamble: */ |
82 | msg += ETH_ADDR_OFFSET; | 80 | msg += TIPC_MEDIA_ADDR_OFFSET; |
83 | return tipc_eth_raw2addr(b, addr, msg); | 81 | return tipc_eth_raw2addr(b, addr, msg); |
84 | } | 82 | } |
85 | 83 | ||
diff --git a/net/tipc/ib_media.c b/net/tipc/ib_media.c index 8522eef9c136..e8c16718e3fa 100644 --- a/net/tipc/ib_media.c +++ b/net/tipc/ib_media.c | |||
@@ -57,7 +57,7 @@ static int tipc_ib_addr2str(struct tipc_media_addr *a, char *str_buf, | |||
57 | /* Convert from media address format to discovery message addr format */ | 57 | /* Convert from media address format to discovery message addr format */ |
58 | static int tipc_ib_addr2msg(char *msg, struct tipc_media_addr *addr) | 58 | static int tipc_ib_addr2msg(char *msg, struct tipc_media_addr *addr) |
59 | { | 59 | { |
60 | memset(msg, 0, TIPC_MEDIA_ADDR_SIZE); | 60 | memset(msg, 0, TIPC_MEDIA_INFO_SIZE); |
61 | memcpy(msg, addr->value, INFINIBAND_ALEN); | 61 | memcpy(msg, addr->value, INFINIBAND_ALEN); |
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
diff --git a/net/tipc/msg.h b/net/tipc/msg.h index 9ace47f44a69..c1cc8d7a5d52 100644 --- a/net/tipc/msg.h +++ b/net/tipc/msg.h | |||
@@ -76,7 +76,7 @@ struct plist; | |||
76 | 76 | ||
77 | #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) | 77 | #define MAX_MSG_SIZE (MAX_H_SIZE + TIPC_MAX_USER_MSG_SIZE) |
78 | 78 | ||
79 | #define TIPC_MEDIA_ADDR_OFFSET 5 | 79 | #define TIPC_MEDIA_INFO_OFFSET 5 |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * TIPC message buffer code | 82 | * TIPC message buffer code |
@@ -688,7 +688,7 @@ static inline void msg_set_redundant_link(struct tipc_msg *m, u32 r) | |||
688 | 688 | ||
689 | static inline char *msg_media_addr(struct tipc_msg *m) | 689 | static inline char *msg_media_addr(struct tipc_msg *m) |
690 | { | 690 | { |
691 | return (char *)&m->hdr[TIPC_MEDIA_ADDR_OFFSET]; | 691 | return (char *)&m->hdr[TIPC_MEDIA_INFO_OFFSET]; |
692 | } | 692 | } |
693 | 693 | ||
694 | /* | 694 | /* |
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index fcb07915aaac..506aaa565da7 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c | |||
@@ -98,7 +98,7 @@ void named_cluster_distribute(struct net *net, struct sk_buff *skb) | |||
98 | continue; | 98 | continue; |
99 | if (!tipc_node_active_links(node)) | 99 | if (!tipc_node_active_links(node)) |
100 | continue; | 100 | continue; |
101 | oskb = skb_copy(skb, GFP_ATOMIC); | 101 | oskb = pskb_copy(skb, GFP_ATOMIC); |
102 | if (!oskb) | 102 | if (!oskb) |
103 | break; | 103 | break; |
104 | msg_set_destnode(buf_msg(oskb), dnode); | 104 | msg_set_destnode(buf_msg(oskb), dnode); |
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c index 72c339e432aa..1c147c869c2e 100644 --- a/net/tipc/subscr.c +++ b/net/tipc/subscr.c | |||
@@ -162,19 +162,6 @@ static void subscr_del(struct tipc_subscription *sub) | |||
162 | atomic_dec(&tn->subscription_count); | 162 | atomic_dec(&tn->subscription_count); |
163 | } | 163 | } |
164 | 164 | ||
165 | /** | ||
166 | * subscr_terminate - terminate communication with a subscriber | ||
167 | * | ||
168 | * Note: Must call it in process context since it might sleep. | ||
169 | */ | ||
170 | static void subscr_terminate(struct tipc_subscription *sub) | ||
171 | { | ||
172 | struct tipc_subscriber *subscriber = sub->subscriber; | ||
173 | struct tipc_net *tn = net_generic(sub->net, tipc_net_id); | ||
174 | |||
175 | tipc_conn_terminate(tn->topsrv, subscriber->conid); | ||
176 | } | ||
177 | |||
178 | static void subscr_release(struct tipc_subscriber *subscriber) | 165 | static void subscr_release(struct tipc_subscriber *subscriber) |
179 | { | 166 | { |
180 | struct tipc_subscription *sub; | 167 | struct tipc_subscription *sub; |
@@ -312,16 +299,14 @@ static void subscr_conn_msg_event(struct net *net, int conid, | |||
312 | { | 299 | { |
313 | struct tipc_subscriber *subscriber = usr_data; | 300 | struct tipc_subscriber *subscriber = usr_data; |
314 | struct tipc_subscription *sub = NULL; | 301 | struct tipc_subscription *sub = NULL; |
302 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
315 | 303 | ||
316 | spin_lock_bh(&subscriber->lock); | 304 | spin_lock_bh(&subscriber->lock); |
317 | if (subscr_subscribe(net, (struct tipc_subscr *)buf, subscriber, | 305 | subscr_subscribe(net, (struct tipc_subscr *)buf, subscriber, &sub); |
318 | &sub) < 0) { | ||
319 | spin_unlock_bh(&subscriber->lock); | ||
320 | subscr_terminate(sub); | ||
321 | return; | ||
322 | } | ||
323 | if (sub) | 306 | if (sub) |
324 | tipc_nametbl_subscribe(sub); | 307 | tipc_nametbl_subscribe(sub); |
308 | else | ||
309 | tipc_conn_terminate(tn->topsrv, subscriber->conid); | ||
325 | spin_unlock_bh(&subscriber->lock); | 310 | spin_unlock_bh(&subscriber->lock); |
326 | } | 311 | } |
327 | 312 | ||