Skip to content

Commit 8d7a5f0

Browse files
oleremmarckleinebudde
authored andcommitted
can: j1939: transport: j1939_cancel_active_session(): use hrtimer_try_to_cancel() instead of hrtimer_cancel()
This part of the code protected by lock used in the hrtimer as well. Using hrtimer_cancel() will trigger dead lock. Fixes: 9d71dd0 ("can: add support of SAE J1939 protocol") Signed-off-by: Oleksij Rempel <[email protected]>
1 parent 62ebce1 commit 8d7a5f0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/can/j1939/transport.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,11 @@ int j1939_cancel_active_session(struct j1939_priv *priv, struct sock *sk)
20392039
&priv->active_session_list,
20402040
active_session_list_entry) {
20412041
if (!sk || sk == session->sk) {
2042-
j1939_session_timers_cancel(session);
2042+
if (hrtimer_try_to_cancel(&session->txtimer) == 1)
2043+
j1939_session_put(session);
2044+
if (hrtimer_try_to_cancel(&session->rxtimer) == 1)
2045+
j1939_session_put(session);
2046+
20432047
session->err = ESHUTDOWN;
20442048
j1939_session_deactivate_locked(session);
20452049
}

0 commit comments

Comments
 (0)