mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
AX.25: Close socket connection on session completion
[ Upstream commit 4a7d99ea1b ]
A socket connection made in ax.25 is not closed when session is
completed. The heartbeat timer is stopped prematurely and this is
where the socket gets closed. Allow heatbeat timer to run to close
socket. Symptom occurs in kernels >= 4.2.0
Originally sent 6/15/2016. Resend with distribution list matching
scripts/maintainer.pl output.
Signed-off-by: Basil Gunn <basil@pacabunga.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b30cc5b14f
commit
eda8951310
@@ -976,6 +976,7 @@ static int ax25_release(struct socket *sock)
|
||||
release_sock(sk);
|
||||
ax25_disconnect(ax25, 0);
|
||||
lock_sock(sk);
|
||||
if (!sock_flag(ax25->sk, SOCK_DESTROY))
|
||||
ax25_destroy_socket(ax25);
|
||||
break;
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *ax25)
|
||||
switch (ax25->state) {
|
||||
|
||||
case AX25_STATE_0:
|
||||
case AX25_STATE_2:
|
||||
/* Magic here: If we listen() and a new link dies before it
|
||||
is accepted() it isn't 'dead' so doesn't get removed. */
|
||||
if (!sk || sock_flag(sk, SOCK_DESTROY) ||
|
||||
@@ -111,6 +112,7 @@ void ax25_ds_heartbeat_expiry(ax25_cb *ax25)
|
||||
sock_hold(sk);
|
||||
ax25_destroy_socket(ax25);
|
||||
bh_unlock_sock(sk);
|
||||
/* Ungrab socket and destroy it */
|
||||
sock_put(sk);
|
||||
} else
|
||||
ax25_destroy_socket(ax25);
|
||||
@@ -213,6 +215,7 @@ void ax25_ds_t1_timeout(ax25_cb *ax25)
|
||||
case AX25_STATE_2:
|
||||
if (ax25->n2count == ax25->n2) {
|
||||
ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);
|
||||
if (!sock_flag(ax25->sk, SOCK_DESTROY))
|
||||
ax25_disconnect(ax25, ETIMEDOUT);
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -38,6 +38,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
|
||||
|
||||
switch (ax25->state) {
|
||||
case AX25_STATE_0:
|
||||
case AX25_STATE_2:
|
||||
/* Magic here: If we listen() and a new link dies before it
|
||||
is accepted() it isn't 'dead' so doesn't get removed. */
|
||||
if (!sk || sock_flag(sk, SOCK_DESTROY) ||
|
||||
@@ -47,6 +48,7 @@ void ax25_std_heartbeat_expiry(ax25_cb *ax25)
|
||||
sock_hold(sk);
|
||||
ax25_destroy_socket(ax25);
|
||||
bh_unlock_sock(sk);
|
||||
/* Ungrab socket and destroy it */
|
||||
sock_put(sk);
|
||||
} else
|
||||
ax25_destroy_socket(ax25);
|
||||
@@ -144,6 +146,7 @@ void ax25_std_t1timer_expiry(ax25_cb *ax25)
|
||||
case AX25_STATE_2:
|
||||
if (ax25->n2count == ax25->n2) {
|
||||
ax25_send_control(ax25, AX25_DISC, AX25_POLLON, AX25_COMMAND);
|
||||
if (!sock_flag(ax25->sk, SOCK_DESTROY))
|
||||
ax25_disconnect(ax25, ETIMEDOUT);
|
||||
return;
|
||||
} else {
|
||||
|
||||
@@ -264,6 +264,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
|
||||
{
|
||||
ax25_clear_queues(ax25);
|
||||
|
||||
if (!sock_flag(ax25->sk, SOCK_DESTROY))
|
||||
ax25_stop_heartbeat(ax25);
|
||||
ax25_stop_t1timer(ax25);
|
||||
ax25_stop_t2timer(ax25);
|
||||
|
||||
Reference in New Issue
Block a user