Unverified Commit f0f580de authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!10564 net: can: j1939: enhanced error handling for tightly received RTS...

!10564  net: can: j1939: enhanced error handling for tightly received RTS messages in xtp_rx_rts_session_new

Merge Pull Request from: @ci-robot 
 
PR sync from: Zhengchao Shao <shaozhengchao@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/XUOQE2UGMVTRVSGLYD2L6XGUYTIWQX3Q/ 
 
https://gitee.com/src-openeuler/kernel/issues/IAH95F 
 
Link:https://gitee.com/openeuler/kernel/pulls/10564

 

Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents 632b5bcf 1348b001
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -1577,8 +1577,8 @@ j1939_session *j1939_xtp_rx_rts_session_new(struct j1939_priv *priv,
	struct j1939_sk_buff_cb skcb = *j1939_skb_to_cb(skb);
	struct j1939_session *session;
	const u8 *dat;
	int len, ret;
	pgn_t pgn;
	int len;

	netdev_dbg(priv->ndev, "%s\n", __func__);

@@ -1634,7 +1634,22 @@ j1939_session *j1939_xtp_rx_rts_session_new(struct j1939_priv *priv,
	session->pkt.rx = 0;
	session->pkt.tx = 0;

	WARN_ON_ONCE(j1939_session_activate(session));
	ret = j1939_session_activate(session);
	if (ret) {
		/* Entering this scope indicates an issue with the J1939 bus.
		 * Possible scenarios include:
		 * - A time lapse occurred, and a new session was initiated
		 *   due to another packet being sent correctly. This could
		 *   have been caused by too long interrupt, debugger, or being
		 *   out-scheduled by another task.
		 * - The bus is receiving numerous erroneous packets, either
		 *   from a malfunctioning device or during a test scenario.
		 */
		netdev_alert(priv->ndev, "%s: 0x%p: concurrent session with same addr (%02x %02x) is already active.\n",
			     __func__, session, skcb.addr.sa, skcb.addr.da);
		j1939_session_put(session);
		return NULL;
	}

	return session;
}