Skip to content

Commit

Permalink
tipc: properly handle off-node send requests with invalid addr
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Allan Stephens authored and Paul Gortmaker committed Apr 19, 2012
1 parent 974a5a8 commit b8f683d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions net/tipc/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -1270,10 +1270,14 @@ int tipc_send2name(u32 ref, struct tipc_name const *name, unsigned int domain,
if (likely(destnode == tipc_own_addr))
res = tipc_port_recv_sections(p_ptr, num_sect,
msg_sect, total_len);
else
else if (tipc_own_addr)
res = tipc_link_send_sections_fast(p_ptr, msg_sect,
num_sect, total_len,
destnode);
else
res = tipc_port_reject_sections(p_ptr, msg, msg_sect,
num_sect, total_len,
TIPC_ERR_NO_NODE);
if (likely(res != -ELINKCONG)) {
if (res > 0)
p_ptr->sent++;
Expand Down Expand Up @@ -1314,9 +1318,12 @@ int tipc_send2port(u32 ref, struct tipc_portid const *dest,
if (dest->node == tipc_own_addr)
res = tipc_port_recv_sections(p_ptr, num_sect, msg_sect,
total_len);
else
else if (tipc_own_addr)
res = tipc_link_send_sections_fast(p_ptr, msg_sect, num_sect,
total_len, dest->node);
else
res = tipc_port_reject_sections(p_ptr, msg, msg_sect, num_sect,
total_len, TIPC_ERR_NO_NODE);
if (likely(res != -ELINKCONG)) {
if (res > 0)
p_ptr->sent++;
Expand Down

0 comments on commit b8f683d

Please sign in to comment.