diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2012-04-18 09:22:56 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2012-04-19 15:46:47 -0400 |
commit | b8f683d126c1cb757e794d6d904cbe7cf5954797 (patch) | |
tree | 70206c678cb16bf0b7e6e32ea8a6a18111c41b03 /net/tipc/port.c | |
parent | 974a5a864bf959b7f3412a31ee8ce001c6628451 (diff) |
tipc: properly handle off-node send requests with invalid addr
There are two send routines that might conceivably be asked by an
application to send a message off-node when the node is still using
the default network address. These now have an added check that
detects this and rejects the message gracefully.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/port.c')
-rw-r--r-- | net/tipc/port.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c index 616c72fb9234..dc7f916b2e10 100644 --- a/net/tipc/port.c +++ b/net/tipc/port.c | |||
@@ -1270,10 +1270,14 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain, | |||
1270 | if (likely(destnode == tipc_own_addr)) | 1270 | if (likely(destnode == tipc_own_addr)) |
1271 | res = tipc_port_recv_sections(p_ptr, num_sect, | 1271 | res = tipc_port_recv_sections(p_ptr, num_sect, |
1272 | msg_sect, total_len); | 1272 | msg_sect, total_len); |
1273 | else | 1273 | else if (tipc_own_addr) |
1274 | res = tipc_link_send_sections_fast(p_ptr, msg_sect, | 1274 | res = tipc_link_send_sections_fast(p_ptr, msg_sect, |
1275 | num_sect, total_len, | 1275 | num_sect, total_len, |
1276 | destnode); | 1276 | destnode); |
1277 | else | ||
1278 | res = tipc_port_reject_sections(p_ptr, msg, msg_sect, | ||
1279 | num_sect, total_len, | ||
1280 | TIPC_ERR_NO_NODE); | ||
1277 | if (likely(res != -ELINKCONG)) { | 1281 | if (likely(res != -ELINKCONG)) { |
1278 | if (res > 0) | 1282 | if (res > 0) |
1279 | p_ptr->sent++; | 1283 | p_ptr->sent++; |
@@ -1314,9 +1318,12 @@ int tipc_send2port(u32 ref, struct tipc_portid const *dest, | |||
1314 | if (dest->node == tipc_own_addr) | 1318 | if (dest->node == tipc_own_addr) |
1315 | res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect, | 1319 | res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect, |
1316 | total_len); | 1320 | total_len); |
1317 | else | 1321 | else if (tipc_own_addr) |
1318 | res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, | 1322 | res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect, |
1319 | total_len, dest->node); | 1323 | total_len, dest->node); |
1324 | else | ||
1325 | res = tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect, | ||
1326 | total_len, TIPC_ERR_NO_NODE); | ||
1320 | if (likely(res != -ELINKCONG)) { | 1327 | if (likely(res != -ELINKCONG)) { |
1321 | if (res > 0) | 1328 | if (res > 0) |
1322 | p_ptr->sent++; | 1329 | p_ptr->sent++; |