[etherlab-dev] TTY driver not compatible with new kernel ?

Titouan Mesot Titouan.Mesot at infoteam.ch
Mon Nov 7 15:11:36 CET 2016


Hello,

I have some issue with the tty driver (for EL6002 modules) with a recent kernel (4.7.1). 
I saw Florian Pose patch it to use tty_port instead of tty_struct (39280d) but it doesn't seems to work anymore. The drivers loads great and entry are added in /dev/ but when you try to send some data on them, you get this error : 

"tty_init_dev: ttyEC driver does not set tty->port. This will crash the kernel later. Fix the driver!"

Full log at the end.

I tried to initialize tty_port but no result yet, maybe someone as a hint ?

Best, 
Titouan Mesot

----FULL log-----
[   41.499956] EtherCAT: Master driver 1.5.2 unknown
[   41.500386] EtherCAT: 1 master waiting for devices.
[   41.506659] ec_generic: EtherCAT master generic Ethernet device module 1.5.2 unknown
[   41.506728] EtherCAT: Accepting 00:0D:B9:42:70:66 as main device for master 0.
[   41.506755] ec_generic: Binding socket to interface 5 (lan3).
[   41.516072] EtherCAT 0: Starting EtherCAT-IDLE thread.
[   41.516262] EtherCAT 0: Link state of ecm0 changed to UP.
[   41.517092] EtherCAT 0: 2 slave(s) responding on main device.
[   41.517100] EtherCAT 0: Slave states on main device: PREOP.
[   41.517387] EtherCAT 0: Scanning bus.
[   41.772521] EtherCAT 0: Bus scanning completed in 255 ms.
[   41.772532] EtherCAT 0: Using slave 0 as DC reference clock.
[   41.772554] EtherCAT ERROR 0: Failed to calculate bus topology.
[   70.792623] ec_tty: TTY driver 1.5.2 unknown
[   75.530821] ec_tty_example: Starting...
[   75.530832] EtherCAT: Requesting master 0...
[   75.530840] EtherCAT: Successfully requested master 0.
[   75.530845] ec_tty_example: Registering domain...
[   75.530857] ec_tty_example: Registering serial devices...
[   75.530869] ec_tty_example: Creating handler for EL6002 at position 1
[   75.531263] ec_tty: Creating TTY interface 0.
[   75.531489] ec_tty_example: EL6002(1) X1: Requested RTS/CTS: no.
[   75.531495] ec_tty_example: EL6002(1) X1: Requested baud rate: 9600.
[   75.531500] ec_tty_example: EL6002(1) X1: Requested Data frame: 8N1.
[   75.531519] ec_tty: Creating TTY interface 1.
[   75.531626] ec_tty_example: EL6002(1) X2: Requested RTS/CTS: no.
[   75.531658] ec_tty_example: EL6002(1) X2: Requested baud rate: 9600.
[   75.531663] ec_tty_example: EL6002(1) X2: Requested Data frame: 8N1.
[   75.531674] ec_tty_example: Finished registering serial devices.
[   75.531677] ec_tty_example: Activating master...
[   75.531689] EtherCAT 0: Domain0: Logical address 0x00000000, 96 byte, expected working counter 3.
[   75.531722] EtherCAT 0:   Datagram domain0-0-main: Logical offset 0x00000000, 96 byte, type LRW.
[   75.531762] EtherCAT 0: Master thread exited.
[   75.531771] EtherCAT 0: Starting EtherCAT-OP thread.
[   75.531873] ec_tty_example: Starting cyclic sample thread.
[   75.531878] ec_tty_example: Started.
[   75.541579] ec_tty_example: 2 slave(s).
[   75.541603] ec_tty_example: AL states: 0x02.
[   75.541621] ec_tty_example: Link is up.
[   75.542572] EtherCAT WARNING 0: No app_time received up to now, but master already active.
[   76.281650] EtherCAT 0: Domain 0: Working counter changed to 3/3.
[   76.281665] ec_tty_example: Domain1: WC 3.
[   76.281670] ec_tty_example: Domain1: State 2.
[   76.341660] ec_tty_example: EL6002(1) X1: Init successful.
[   76.341667] ec_tty_example: EL6002(1) X2: Init successful.
[   76.342662] EtherCAT 0: Slave states on main device: OP.
[   76.421661] ec_tty_example: EL6002(1) X1: Accepted RTS/CTS.
[   76.451660] ec_tty_example: EL6002(1) X2: Accepted RTS/CTS.
[   76.471676] ec_tty_example: EL6002(1) X1: Init successful.
[   76.501679] ec_tty_example: EL6002(1) X2: Init successful.
[   76.531670] ec_tty_example: EL6002(1) X1: Accepted baud rate.
[   76.551672] ec_tty_example: AL states: 0x08.
[   76.561702] ec_tty_example: EL6002(1) X2: Accepted baud rate.
[   76.581704] ec_tty_example: EL6002(1) X1: Init successful.
[   76.611686] ec_tty_example: EL6002(1) X2: Init successful.
[   76.641680] ec_tty_example: EL6002(1) X1: Accepted data frame.
[   76.671690] ec_tty_example: EL6002(1) X2: Accepted data frame.
[   76.691695] ec_tty_example: EL6002(1) X1: Init successful.
[   76.721728] ec_tty_example: EL6002(1) X2: Init successful.
[  118.833157] ------------[ cut here ]------------
[  118.833184] WARNING: CPU: 2 PID: 1734 at drivers/tty/tty_io.c:1544 tty_init_dev+0x17e/0x1c0
[  118.833207] tty_init_dev: ttyEC driver does not set tty->port. This will crash the kernel later. Fix the driver!
[  118.833225] Modules linked in: ec_tty_example(O) ec_tty(O) ec_generic(O) ec_master(O)
[  118.833245] CPU: 2 PID: 1734 Comm: sh Tainted: G           O    4.7.1 #2
[  118.833250] Hardware name: PC Engines apu2/apu2, BIOS 88a4f96 03/07/2016
[  118.833255]  0000000000000000 ffff880119797b20 ffffffff812b4d68 ffff880119797b70
[  118.833264]  0000000000000000 ffff880119797b60 ffffffff81052157 000006088184f1ab
[  118.833272]  ffff8800db328000 ffff8800daca8900 0000000000000000 0000000000000000
[  118.833280] Call Trace:
[  118.833294]  [<ffffffff812b4d68>] dump_stack+0x4d/0x65
[  118.833303]  [<ffffffff81052157>] __warn+0xc7/0xf0
[  118.833310]  [<ffffffff810521ca>] warn_slowpath_fmt+0x4a/0x50
[  118.833318]  [<ffffffff812ba7b5>] ? ___ratelimit+0x75/0xd0
[  118.833356]  [<ffffffff8135bfee>] tty_init_dev+0x17e/0x1c0
[  118.833363]  [<ffffffff8135c57a>] tty_open+0x54a/0x620
[  118.833374]  [<ffffffff81144012>] chrdev_open+0xa2/0x170
[  118.833412]  [<ffffffff8113cfca>] do_dentry_open+0x1da/0x2f0
[  118.833419]  [<ffffffff81143f70>] ? cdev_put+0x20/0x20
[  118.833426]  [<ffffffff8113e262>] vfs_open+0x52/0x70
[  118.833432]  [<ffffffff8114a257>] ? may_open+0x87/0x100
[  118.833439]  [<ffffffff8114c9a8>] path_openat+0x2d8/0x14c0
[  118.833464]  [<ffffffff8114f519>] do_filp_open+0x79/0xd0
[  118.833485]  [<ffffffff811370db>] ? kmem_cache_alloc+0x2b/0xd0
[  118.833494]  [<ffffffff8115c60a>] ? __alloc_fd+0x3a/0x170
[  118.833501]  [<ffffffff8113e591>] do_sys_open+0x111/0x1f0
[  118.833510]  [<ffffffff81060122>] ? SyS_rt_sigaction+0x82/0x90
[  118.833546]  [<ffffffff8113e689>] SyS_open+0x19/0x20
[  118.833555]  [<ffffffff81854bdb>] entry_SYSCALL_64_fastpath+0x13/0x8f
[  118.833569] ---[ end trace 8db6085e7d119b1e ]---
[  118.833585] BUG: unable to handle kernel NULL pointer dereference at 0000000000000098
[  118.841816] IP: [<ffffffff8135bef1>] tty_init_dev+0x81/0x1c0
[  118.847709] PGD d141f067 PUD d1427067 PMD 0
[  118.852253] Oops: 0002 [#1] SMP
[  118.855468] Modules linked in: ec_tty_example(O) ec_tty(O) ec_generic(O) ec_master(O)
[  118.863768] CPU: 2 PID: 1734 Comm: sh Tainted: G        W  O    4.7.1 #2
[  118.870811] Hardware name: PC Engines apu2/apu2, BIOS 88a4f96 03/07/2016
[  118.877817] task: ffff8800d9f4bd40 ti: ffff880119794000 task.ti: ffff880119794000
[  118.885591] RIP: 0010:[<ffffffff8135bef1>]  [<ffffffff8135bef1>] tty_init_dev+0x81/0x1c0
[  118.894185] RSP: 0018:ffff880119797bd0  EFLAGS: 00010282
[  118.899742] RAX: 0000000000000000 RBX: ffff8800db328000 RCX: ffffffff81e3b538
[  118.907045] RDX: 0000000000000024 RSI: 0000000000000000 RDI: 0000000000000009
[  118.914495] RBP: ffff880119797bf0 R08: 0000000000000030 R09: 0000000000000000
[  118.921912] R10: 0000000000000280 R11: 000000000000029b R12: ffff8800daca8900
[  118.929311] R13: 0000000000000000 R14: 0000000000000000 R15: ffff8800d9f4bd40
[  118.936755] FS:  00007fcbb10fa700(0000) GS:ffff88011ed00000(0000) knlGS:0000000000000000
[  118.945237] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  118.951272] CR2: 0000000000000098 CR3: 00000000d9ec2000 CR4: 00000000000406e0
[  118.958687] Stack:
[  118.960761]  ffff8800db2e9e80 ffff880119b92700 0000000000000000 ffff8800dac602d8
[  118.968627]  ffff880119797c50 ffffffff8135c57a 00000000000000f5 ffff8800daca8900
[  118.976411]  ffff8800d9f4bd40 0f50000000008241 0000000019797c64 ffffffff81a50b00
[  118.984120] Call Trace:
[  118.986684]  [<ffffffff8135c57a>] tty_open+0x54a/0x620
[  118.992078]  [<ffffffff81144012>] chrdev_open+0xa2/0x170
[  118.997584]  [<ffffffff8113cfca>] do_dentry_open+0x1da/0x2f0
[  119.003486]  [<ffffffff81143f70>] ? cdev_put+0x20/0x20
[  119.008786]  [<ffffffff8113e262>] vfs_open+0x52/0x70
[  119.013980]  [<ffffffff8114a257>] ? may_open+0x87/0x100
[  119.019513]  [<ffffffff8114c9a8>] path_openat+0x2d8/0x14c0
[  119.025270]  [<ffffffff8114f519>] do_filp_open+0x79/0xd0
[  119.030762]  [<ffffffff811370db>] ? kmem_cache_alloc+0x2b/0xd0
[  119.036864]  [<ffffffff8115c60a>] ? __alloc_fd+0x3a/0x170
[  119.042440]  [<ffffffff8113e591>] do_sys_open+0x111/0x1f0
[  119.048119]  [<ffffffff81060122>] ? SyS_rt_sigaction+0x82/0x90
[  119.054289]  [<ffffffff8113e689>] SyS_open+0x19/0x20
[  119.059428]  [<ffffffff81854bdb>] entry_SYSCALL_64_fastpath+0x13/0x8f
[  119.066142] Code: 84 24 a0 00 00 00 48 89 de 4c 89 e7 48 8b 40 08 48 85 c0 74 72 ff d0 85 c0 78 73 48 8b 83 e0 02 00 00 48 85 c0 0f 84 89 00 00 00 <48> 89 98 98 00 00 00 48 8b b3 18 02 00 00 48 89 df e8 99 5f 00
[  119.087740] RIP  [<ffffffff8135bef1>] tty_init_dev+0x81/0x1c0
[  119.093836]  RSP <ffff880119797bd0>
[  119.097506] CR2: 0000000000000098
[  119.101064] ---[ end trace 8db6085e7d119b1f ]---
$





More information about the Etherlab-dev mailing list