[PATCH v1 09/34] j1939: transport: do not send CTS or EOMA if no more receiver exist

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

 



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

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 30d3e60c0e23..d7b9da858f62 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -802,10 +802,14 @@ static int j1939_xtp_txnext_transmiter(struct j1939_session *session)
 
 static int j1939_session_tx_cts(struct j1939_session *session)
 {
+	struct j1939_priv *priv = session->priv;
 	unsigned int pkt, len;
 	int ret;
 	u8 dat[8];
 
+	if (!j1939_sk_recv_match(priv, &session->skcb))
+		return -ENOENT;
+
 	len = session->pkt.total - session->pkt.rx;
 	len = min3(len, session->pkt.block, j1939_tp_block ?: 255);
 	memset(dat, 0xff, sizeof(dat));
@@ -841,9 +845,13 @@ static int j1939_session_tx_cts(struct j1939_session *session)
 
 static int j1939_session_tx_eoma(struct j1939_session *session)
 {
+	struct j1939_priv *priv = session->priv;
 	u8 dat[8];
 	int ret;
 
+	if (!j1939_sk_recv_match(priv, &session->skcb))
+		return -ENOENT;
+
 	memset(dat, 0xff, sizeof(dat));
 
 	if (session->skcb.addr.type == J1939_ETP) {
-- 
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