Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> --- net/can/j1939/socket.c | 7 ++++++- net/can/j1939/transport.c | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c index 3c1b3c0ec18f..da93afee1d0a 100644 --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -811,7 +811,6 @@ static struct sk_buff *j1939_sk_alloc_skb(struct net_device *ndev, ret = memcpy_from_msg(skb_put(skb, size), msg, size); if (ret < 0) goto free_skb; - sock_tx_timestamp(sk, skb->sk->sk_tsflags, &skb_shinfo(skb)->tx_flags); skb->dev = ndev; @@ -901,11 +900,17 @@ void j1939_sk_errqueue(struct j1939_session *session, memset(serr, 0, sizeof(*serr)); switch (type) { case J1939_ERRQUEUE_ACK: + if (!(sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK)) + return; + serr->ee.ee_errno = ENOMSG; serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING; serr->ee.ee_info = SCM_TSTAMP_ACK; break; case J1939_ERRQUEUE_SCHED: + if (!(sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED)) + return; + serr->ee.ee_errno = ENOMSG; serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING; serr->ee.ee_info = SCM_TSTAMP_SCHED; diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c index 4d285a92bd41..c2573d0f0721 100644 --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -1004,7 +1004,6 @@ static int j1939_simple_txnext(struct j1939_session *session) return -ENOMEM; can_skb_set_owner(skb, se_skb->sk); - skb_shinfo(skb)->tx_flags &= ~SKBTX_ANY_TSTAMP; j1939_tp_set_rxtimeout(session, J1939_XTP_ABORT_TIMEOUT_MS); -- 2.20.1