linux-hams.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] ax25: Fix segfault after sock connection timeout
@ 2017-01-14 20:18 Basil Gunn
  2017-01-16 19:40 ` David Miller
  0 siblings, 1 reply; 17+ messages in thread
From: Basil Gunn @ 2017-01-14 20:18 UTC (permalink / raw)
  To: Joerg Reuter, Ralf Baechle, David S. Miller, linux-hams, netdev,
	linux-kernel
  Cc: stable, Jeremy McDermond, f6bvp

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>
---

diff --git a/net/ax25/ax25_subr.c b/net/ax25/ax25_subr.c
index 4855d18..038b109 100644
--- a/net/ax25/ax25_subr.c
+++ b/net/ax25/ax25_subr.c
@@ -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);

^ permalink raw reply related	[flat|nested] 17+ messages in thread
* [BUG] AX.25 sockets not destroyed
@ 2017-02-25 13:08 f6bvp
  0 siblings, 0 replies; 17+ messages in thread
From: f6bvp @ 2017-02-25 13:08 UTC (permalink / raw)
  To: linux-hams

[-- Attachment #1: Type: text/plain, Size: 1 bytes --]



[-- Attachment #2: Bug_AX25_sockets_not_destroyed.txt --]
[-- Type: text/plain, Size: 4714 bytes --]

Hi,

It's nice to have no more kernel panic, thanks to Basil Gunn's AX.25 recently applied patch.

However, an issue remains when an AX.25 connection fails or after disconnecting from a remote station.

/proc/net/ax25 remains populated by a number of entries forever as shown here :

[root@f6bvp-6 bernard]# cat /proc/net/ax25
ffff8c80b5ed6c00 ax0 TM6BVP-1 FE6BVP-1 1 0 0 0 15 50 0 3 0 300 0 0 4 10 5 2 256 0 0 18495
ffff8c80b5ed6400 ax0 TM6BVP-1 F6BVP-1 1 0 0 0 15 50 0 3 0 300 0 0 4 10 5 2 256 0 0 18493
ffff8c80b5ef5800 ax0 F6BVP-6 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18299
ffff8c80b5ef6000 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18296
ffff8c80b5ed7400 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18472
ffff8c80b5ed5800 ax0 F6BVP-7 F4BWT-9 1 0 0 0 1 60 0 3 0 300 0 0 5 10 5 2 256 * * *
ffff8c80b5ed5400 ax0 F6BVP-7 WA3MEZ-9 1 0 0 0 1 60 0 3 0 300 0 0 5 10 5 2 256 * * *
[root@f6bvp-6 bernard]# cat /proc/net/ax25
ffff8c80b5ed6c00 ax0 TM6BVP-1 FE6BVP-1 1 0 0 0 14 50 0 3 0 300 0 0 4 10 5 2 256 0 0 18495
ffff8c80b5ed6400 ax0 TM6BVP-1 F6BVP-1 1 0 0 0 14 50 0 3 0 300 0 0 4 10 5 2 256 0 0 18493
ffff8c80b5ef5800 ax0 F6BVP-6 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18299
ffff8c80b5ef6000 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18296
ffff8c80b5ed7400 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18472
ffff8c80b5ed5800 ax0 F6BVP-7 F4BWT-9 1 0 0 0 0 60 0 3 0 300 0 0 5 10 5 2 256 * * *
ffff8c80b5ed5400 ax0 F6BVP-7 WA3MEZ-9 1 0 0 0 0 60 0 3 0 300 0 0 5 10 5 2 256 * * *
[root@f6bvp-6 bernard]# cat /proc/net/ax25
ffff8c80b5ed6c00 ax0 TM6BVP-1 FE6BVP-1 1 0 0 0 13 50 0 3 0 300 0 0 4 10 5 2 256 0 0 18495
ffff8c80b5ed6400 ax0 TM6BVP-1 F6BVP-1 1 0 0 0 13 50 0 3 0 300 0 0 4 10 5 2 256 0 0 18493
ffff8c80b5ef5800 ax0 F6BVP-6 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18299
ffff8c80b5ef6000 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18296
ffff8c80b5ed7400 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18472
ffff8c80b5ed5800 ax0 F6BVP-7 F4BWT-9 1 0 0 0 18446744073709550 60 0 3 0 300 0 0 5 10 5 2 256 * * *
ffff8c80b5ed5400 ax0 F6BVP-7 WA3MEZ-9 1 0 0 0 18446744073709550 60 0 3 0 300 0 0 5 10 5 2 256 * * *
[root@f6bvp-6 bernard]# cat /proc/net/ax25
ffff8c80b5ed6c00 ax0 TM6BVP-1 FE6BVP-1 1 0 0 0 75 100 0 3 0 300 0 0 9 10 5 2 256 0 0 18495
ffff8c80b5ed6400 ax0 TM6BVP-1 F6BVP-1 1 0 0 0 75 100 0 3 0 300 0 0 9 10 5 2 256 0 0 18493
ffff8c80b5ef5800 ax0 F6BVP-6 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18299
ffff8c80b5ef6000 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18296
ffff8c80b5ed7400 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18472
ffff8c80b5ed5800 ax0 F6BVP-7 F4BWT-9 1 0 0 0 18446744073709549 100 0 3 0 300 0 0 9 10 5 2 256 * * *
ffff8c80b5ed5400 ax0 F6BVP-7 WA3MEZ-9 1 0 0 0 18446744073709549 100 0 3 0 300 0 0 9 10 5 2 256 * * *

[root@f6bvp-6 bernard]# cat /proc/net/ax25
ffff8c809025a800 ax0 TM6BVP-1 FE6BVP-1 1 0 0 0 25 60 0 3 0 300 0 0 5 10 5 2 256 0 0 29417
ffff8c809025bc00 ax0 TM6BVP-1 F6BVP-1 1 0 0 0 25 60 0 3 0 300 0 0 5 10 5 2 256 0 0 29416
ffff8c80b5ef5800 ax0 F6BVP-6 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18299
ffff8c80b5ef6000 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18296
ffff8c80b5ed7400 ax0 TM6BVP-1 * 0 0 0 0 0 10 0 3 0 300 0 0 0 10 5 2 256 0 0 18472
ffff8c80b5ed5800 ax0 F6BVP-7 F4BWT-9 0 0 0 0 0 110 0 3 0 300 0 0 10 10 5 2 256 * * *
ffff8c80b5ed5400 ax0 F6BVP-7 WA3MEZ-9 0 0 0 0 0 110 0 3 0 300 0 0 10 10 5 2 256 * * *

While AX.25 connections are attempted with adjacent nodes (4th field =1) when system is started-up, one can see that 8th field  
of /proc/net/ax25 first two lines is counting down from 15 to 13 in above samples.
At the same time, for example on line 
"ax0 F6BVP-7 WA3MEZ-9 1 0 0 0 1 60 0 3 0 300" 
the 8th field goes down from some number to 0,
F6BVP-7 WA3MEZ-9 1 0 0 0 0 60 0 3 0 300 0 
then it displays a very large number for a while,
ax0 F6BVP-7 F4BWT-9 1 0 0 0 18446744073709549 100 0 3 0 300 0
then it starts again with a "normal" number.
After a while, all unconnected entries stay stable :
ax0 F6BVP-7 F4BWT-9 0 0 0 0 0 110 0 3 0 300 0 0 10 10 5 2 256 * * *
And /proc/net/ax25 display the same unconnected entries forever.

I also observed that this situation prevents a new connection to occur for the same destination call.

I tried to apply some AX.25 patch I had received previously without success on stable kernel 4.1.38, and kernels 4.9.11 and 4.10.0.
Same symptoms are seen on all my computers : i686 and RPis.

I think this means that AX.25 sockets are never closed (destroyed) when a timer is expired after a connection attempt or a disconnection.

Bernard, f6bvp

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-01-02 11:52 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-14 20:18 [PATCH 1/1] ax25: Fix segfault after sock connection timeout Basil Gunn
2017-01-16 19:40 ` David Miller
     [not found]   ` <1a4ee351-031c-932e-0332-779ce33e90e6@trinnet.net>
     [not found]     ` <20170201080217.4d8443bb@brox.localnet>
     [not found]       ` <3e3f25fc-fc60-c01b-1139-245284200656@trinnet.net>
     [not found]         ` <39dad041-f224-735e-adb7-e0fb42771858@free.fr>
     [not found]           ` <25ee9245-3595-85f7-93b8-a18d6066a2e3@free.fr>
     [not found]             ` <07a1454e-99a2-8cec-d50a-006257687c2e@free.fr>
     [not found]               ` <12e0547b-cb2c-1ca0-abc0-d849d8a62139@trinnet.net>
     [not found]                 ` <598de982-d655-22bd-c5ba-2d9114f9fb7c@free.fr>
2017-02-23 17:56                   ` [BUG] AX.25 sockets not destroyed Ralf Baechle DL5RB
     [not found]                 ` <3d0e170e-3995-84d0-007e-3d2065296237@free.fr>
     [not found]                   ` <9f9dba49-c2a5-41e8-9382-9154802e7fbf@trinnet.net>
     [not found]                     ` <20170327163641.0f992e2d@brox.localnet>
2017-04-11 17:26                       ` Interesting Rose patch f6bvp
2017-04-12  8:19                         ` f6bvp
2017-04-12 20:43                         ` Walter Harms
2017-04-13 13:19                           ` f6bvp
     [not found]                             ` <a4f993a0-b12a-f3e6-455c-16ea2da28737@trinnet.net>
2017-04-17 16:15                               ` f6bvp
2017-04-17 16:27                                 ` f6bvp
2017-04-19 14:11                                 ` f6bvp
     [not found]                                 ` <4188542e-1404-badc-cc8d-8bb07cb6d55a@free.fr>
     [not found]                                   ` <969c06f8-572b-db66-3ebb-1e02205461fa@trinnet.net>
     [not found]                                     ` <b20c7da4-66f5-0f6b-ac21-41ab075b9d69@free.fr>
     [not found]                                       ` <21e6f319-f0cf-276e-a374-d44c9bd8827e@free.fr>
2019-01-02 11:52                                         ` [ROSE] rose dereferenced pointer kernel panic Dmitry Vyukov
2017-06-28 12:24                               ` Interesting Rose patch f6bvp
2017-06-28 15:20                                 ` David Ranch
2017-04-18 16:14                           ` Fwd: " David Ranch
2017-04-18 18:12                             ` f6bvp
2017-05-16 18:27                             ` Fwd: " f6bvp
  -- strict thread matches above, loose matches on Subject: below --
2017-02-25 13:08 [BUG] AX.25 sockets not destroyed f6bvp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).