Usual ETP session may block sock_alloc_send_skb(), it is OK so far we have no downstream errors. If session was aborted downstream, the session will stay in sock_alloc_send_skb() blocked forever. To avoid this kind of situations, we should propagate session errors to all socket related components. Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> --- net/can/j1939/j1939-priv.h | 2 ++ net/can/j1939/socket.c | 8 ++++++++ net/can/j1939/transport.c | 2 ++ 3 files changed, 12 insertions(+) diff --git a/net/can/j1939/j1939-priv.h b/net/can/j1939/j1939-priv.h index 018a0d1707fe..bdf2aa2c367d 100644 --- a/net/can/j1939/j1939-priv.h +++ b/net/can/j1939/j1939-priv.h @@ -150,6 +150,8 @@ static inline struct j1939_sk_buff_cb *j1939_skb_to_cb(struct sk_buff *skb) int j1939_send_one(struct j1939_priv *priv, struct sk_buff *skb); void j1939_sk_recv(struct j1939_priv *priv, struct sk_buff *skb); +void j1939_sk_send_multi_abort(struct j1939_priv *priv, struct sock *sk, + int err); /* stack entries */ struct j1939_session *j1939_tp_send(struct j1939_priv *priv, diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c index 01d1edc76cac..c05e74a0abdb 100644 --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -700,6 +700,14 @@ static struct sk_buff *j1939_sk_alloc_skb(struct net_device *ndev, struct sock * return NULL; } +void j1939_sk_send_multi_abort(struct j1939_priv *priv, struct sock *sk, + int err) +{ + sk->sk_err = err; + + sk->sk_error_report(sk); +} + static int j1939_sk_send_multi(struct j1939_priv *priv, struct sock *sk, struct msghdr *msg, size_t complete_size) diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c index 0efcb02b2794..774c5bb2a308 100644 --- a/net/can/j1939/transport.c +++ b/net/can/j1939/transport.c @@ -709,6 +709,8 @@ static void j1939_session_cancel(struct j1939_session *session, !(session->skcb.src_flags & J1939_ECU_LOCAL), err, session->skcb.addr.dst_pgn); + if (session->sk) + j1939_sk_send_multi_abort(priv, session->sk, -EIO); __j1939_session_drop(session); } -- 2.20.1