All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] tipc: don't reject messages if reversal fails
@ 2015-04-10 11:58 erik.hugne
  2015-04-10 12:15 ` Erik Hugne
  0 siblings, 1 reply; 2+ messages in thread
From: erik.hugne @ 2015-04-10 11:58 UTC (permalink / raw)
  To: richard.alpe, jon.maloy, ying.xue, netdev; +Cc: tipc-discussion, Erik Hugne

From: Erik Hugne <erik.hugne@ericsson.com>

When we fail to deliver a message to a socket, it is subject to
message reversal. If the call to tipc_msg_reverse fails, we are
passing dnode uninitialized to tipc_link_xmit_skb which causes the
packet to either be dropped, or sent out to a random link. In the
worst case this leads to a link reset.
We fix this by only transmitting the message if reversal succeded.
Also, the redundant check for 'err' is removed, because if the message
was not consumed, it will always be set.

Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
---
v2: err check fix according to comments from Billie Alsup

 net/tipc/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index ee90d74..d215f73 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1701,7 +1701,7 @@ static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
 			atomic_add(truesize, dcnt);
 		return 0;
 	}
-	if (!err || tipc_msg_reverse(tsk_own_node(tsk), skb, &dnode, -err))
+	if (tipc_msg_reverse(tsk_own_node(tsk), skb, &dnode, -err))
 		tipc_link_xmit_skb(net, skb, dnode, tsk->portid);
 	return 0;
 }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] tipc: don't reject messages if reversal fails
  2015-04-10 11:58 [PATCH v2] tipc: don't reject messages if reversal fails erik.hugne
@ 2015-04-10 12:15 ` Erik Hugne
  0 siblings, 0 replies; 2+ messages in thread
From: Erik Hugne @ 2015-04-10 12:15 UTC (permalink / raw)
  To: richard.alpe, jon.maloy, ying.xue, netdev; +Cc: tipc-discussion

Please ignore this, i meant to send it only to tipc-discussion for review first..

//E

On Fri, Apr 10, 2015 at 01:58:18PM +0200, erik.hugne@ericsson.com wrote:
> From: Erik Hugne <erik.hugne@ericsson.com>
> 
> When we fail to deliver a message to a socket, it is subject to
> message reversal. If the call to tipc_msg_reverse fails, we are
> passing dnode uninitialized to tipc_link_xmit_skb which causes the
> packet to either be dropped, or sent out to a random link. In the
> worst case this leads to a link reset.
> We fix this by only transmitting the message if reversal succeded.
> Also, the redundant check for 'err' is removed, because if the message
> was not consumed, it will always be set.
> 
> Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
> ---
> v2: err check fix according to comments from Billie Alsup
> 
>  net/tipc/socket.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index ee90d74..d215f73 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -1701,7 +1701,7 @@ static int tipc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
>  			atomic_add(truesize, dcnt);
>  		return 0;
>  	}
> -	if (!err || tipc_msg_reverse(tsk_own_node(tsk), skb, &dnode, -err))
> +	if (tipc_msg_reverse(tsk_own_node(tsk), skb, &dnode, -err))
>  		tipc_link_xmit_skb(net, skb, dnode, tsk->portid);
>  	return 0;
>  }
> -- 
> 2.1.4
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-04-10 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 11:58 [PATCH v2] tipc: don't reject messages if reversal fails erik.hugne
2015-04-10 12:15 ` Erik Hugne

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.