ax25: Fix segfault after sock connection timeout

The ax.25 socket connection timed out & the sock struct has been
previously taken down ie. sock struct is now a NULL pointer. Checking
the sock_flag causes the segfault.  Check if the socket struct pointer
is NULL before checking sock_flag. This segfault is seen in
timed out netrom connections.

Please submit to -stable.

Signed-off-by: Basil Gunn <basil@pacabunga.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Basil Gunn 2017-01-14 12:18:55 -08:00 коммит произвёл David S. Miller
Родитель f1f7714ea5
Коммит 8a367e74c0
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -264,7 +264,7 @@ void ax25_disconnect(ax25_cb *ax25, int reason)
{
ax25_clear_queues(ax25);
if (!sock_flag(ax25->sk, SOCK_DESTROY))
if (!ax25->sk || !sock_flag(ax25->sk, SOCK_DESTROY))
ax25_stop_heartbeat(ax25);
ax25_stop_t1timer(ax25);
ax25_stop_t2timer(ax25);