[PATCH v1 14/21] j1939: socket: cancel all socket related active sessions on j1939_sk_release()

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

 



Since we may have multiple active sessions started from one socket, we
need to take care of them to properly clean up the resources.

This action is needed only if user space application is send a signal,
i.e. when aborting the application with Ctrl-c.

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

diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
index 9308e08d6ba9..e208eaa22ef9 100644
--- a/net/can/j1939/socket.c
+++ b/net/can/j1939/socket.c
@@ -560,8 +560,10 @@ static int j1939_sk_release(struct socket *sock)
 		priv = j1939_priv_get_by_ndev(ndev);
 
 		if (wait_event_interruptible(jsk->waitq,
-					     !j1939_sock_pending_get(&jsk->sk)))
+					     !j1939_sock_pending_get(&jsk->sk))) {
+			j1939_cancel_active_session(priv, sk);
 			j1939_sk_queue_drop_all(priv, jsk, ESHUTDOWN);
+		}
 
 		j1939_jsk_del(priv, jsk);
 
-- 
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