[PATCH v1 11/17] j1939: transport: abort not started session if requested

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



By simulating bad network configuration for example with:
jcat can0:0x90 -r > /tmp/blup1 &
jcat can1:0x90 -r > /tmp/blup2 &
session would stall if we not abort it on abort request.
So, abort any session if we are requested to do so.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 net/can/j1939/transport.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 13ffc7d315b2..e4668979a2a5 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -950,6 +950,7 @@ static void j1939_xtp_rx_abort_one(struct j1939_priv *priv, struct sk_buff *skb,
 {
 	struct j1939_sk_buff_cb *skcb = j1939_skb_to_cb(skb);
 	struct j1939_session *session;
+	u8 abort = skb->data[1];
 	pgn_t pgn;
 
 	pgn = j1939_xtp_ctl_to_pgn(skb->data);
@@ -957,24 +958,12 @@ static void j1939_xtp_rx_abort_one(struct j1939_priv *priv, struct sk_buff *skb,
 	if (!session)
 		return;
 
-	if (session->transmission && !session->last_txcmd) {
-		/* empty block:
-		 * do not drop session when a transmit session did not
-		 * start yet
-		 */
-	} else if (session->skcb.addr.pgn == pgn) {
-		u8 abort = skb->data[1];
-
-		j1939_session_timers_cancel(session);
-		session->err = j1939_xtp_abort_to_errno(priv, abort);
-		if (session->sk)
-			j1939_sk_send_multi_abort(priv, session->sk,
-						  session->err);
-	}
+	j1939_session_timers_cancel(session);
+	session->err = j1939_xtp_abort_to_errno(priv, abort);
+	if (session->sk)
+		j1939_sk_send_multi_abort(priv, session->sk,
+					  session->err);
 
-	/* TODO: maybe cancel current connection
-	 * as another pgn was communicated
-	 */
 	j1939_session_put(session);
 }
 
-- 
2.20.1




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux