Commit 63fa01c1 authored by Erik Hugne's avatar Erik Hugne Committed by David S. Miller

tipc: failed transmissions should return error

When a message could not be sent out because the destination node
or link could not be found, the full message size is returned from
sendmsg() as if it had been sent successfully. An application will
then get a false indication that it's making forward progress. This
problem has existed since the initial commit in 2.6.16.

We change this to return -ENETUNREACH if the message cannot be
delivered due to the destination node/link being unavailable. We
also get rid of the redundant tipc_reject_msg call since freeing
the buffer and doing a tipc_port_iovec_reject accomplishes exactly
the same thing.
Signed-off-by: default avatarErik Hugne <erik.hugne@ericsson.com>
Reviewed-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5f4d4e3f
...@@ -1020,12 +1020,9 @@ int tipc_link_iovec_xmit_fast(struct tipc_port *sender, ...@@ -1020,12 +1020,9 @@ int tipc_link_iovec_xmit_fast(struct tipc_port *sender,
read_unlock_bh(&tipc_net_lock); read_unlock_bh(&tipc_net_lock);
/* Couldn't find a link to the destination node */ /* Couldn't find a link to the destination node */
if (buf) kfree_skb(buf);
return tipc_reject_msg(buf, TIPC_ERR_NO_NODE); tipc_port_iovec_reject(sender, hdr, msg_sect, len, TIPC_ERR_NO_NODE);
if (res >= 0) return -ENETUNREACH;
return tipc_port_iovec_reject(sender, hdr, msg_sect, len,
TIPC_ERR_NO_NODE);
return res;
} }
/* /*
...@@ -1163,8 +1160,9 @@ static int tipc_link_iovec_long_xmit(struct tipc_port *sender, ...@@ -1163,8 +1160,9 @@ static int tipc_link_iovec_long_xmit(struct tipc_port *sender,
} else { } else {
reject: reject:
kfree_skb_list(buf_chain); kfree_skb_list(buf_chain);
return tipc_port_iovec_reject(sender, hdr, msg_sect, tipc_port_iovec_reject(sender, hdr, msg_sect, len,
len, TIPC_ERR_NO_NODE); TIPC_ERR_NO_NODE);
return -ENETUNREACH;
} }
/* Append chain of fragments to send queue & send them */ /* Append chain of fragments to send queue & send them */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment