lirc_zilog bugs
Subsystems (2)
cover lirc_zilog bugs
This driver has a few problems, however the driver has been removed from staging in v4.16 (replaced by a new driver). Please can these patches be included in the 4.14.* stable tree.
Sean Young (2):
Revert "media: lirc_zilog: driver only sends LIRCCODE"
media: staging: lirc_zilog: incorrect reference counting
drivers/staging/media/lirc/lirc_zilog.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.3
PATCH 1/2 Revert "media: lirc_zilog: driver only sends LIRCCODE"
The lirc config documented here
https://www.blushingpenguin.com/mark/blog/?p=24 uses raw_codes for sending IR. Each key only has one pulse, which in fact is an index into the haup-ir-blaster.bin file. Changing the driver to LIRCCODE (although more accurate) breaks this configuration.
This code has been replaced completely in kernel v4.16 by a new driver, see commit acaa34bf06e9 ("media: rc: implement zilog transmitter"), and commit f95367a7b758 ("media: staging: remove lirc_zilog driver").
This reverts commit 89d8a2cc51d1f29ea24a0b44dde13253141190a0.
--- drivers/staging/media/lirc/lirc_zilog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/media/lirc/lirc_zilog.c +4 -4
@@ -288,7 +288,7 @@ static void release_ir_tx(struct kref *ref) struct IR_tx *tx = container_of(ref, struct IR_tx, ref);struct IR *ir = tx->ir; - ir->l.features &= ~LIRC_CAN_SEND_LIRCCODE ; + ir->l.features &= ~LIRC_CAN_SEND_PULSE ;/* Don't put_ir_device(tx->ir) here, so our lock doesn't get freed */ ir->tx =NULL ;kfree (tx);
@@ -1267,14 +1267,14 @@ static long ioctl(struct file *filep, unsigned int cmd, unsigned long arg)if (!(features &LIRC_CAN_SEND_MASK ))return -ENOTTY ; - result =put_user (LIRC_MODE_LIRCCODE , uptr); + result =put_user (LIRC_MODE_PULSE , uptr);break ;case LIRC_SET_SEND_MODE :if (!(features &LIRC_CAN_SEND_MASK ))return -ENOTTY ; result =get_user (mode, uptr); -if (!result && mode !=LIRC_MODE_LIRCCODE ) +if (!result && mode !=LIRC_MODE_PULSE )return -EINVAL ;break ;default :
@@ -1512,7 +1512,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)kref_init (&tx->ref); ir->tx = tx; - ir->l.features |=LIRC_CAN_SEND_LIRCCODE ; + ir->l.features |=LIRC_CAN_SEND_PULSE ;mutex_init (&tx->client_lock); tx->c = client; tx->need_boot =1 ;
Signature · 1 line
2.14.3
PATCH 2/2 media: staging: lirc_zilog: incorrect reference counting
In reply to Sean YoungWhenever poll is called, the reference count is increased but never decreased. This means that on rmmod, the lirc_thread is not stopped, and will trample over freed memory.
Zilog/Hauppauge IR driver unloaded
BUG: unable to handle kernel paging request at ffffffffc17ba640 Oops: 0010 [#1] SMP CPU: 1 PID: 667 Comm: zilog-rx-i2c-1 Tainted: P C OE 4.13.16-302.fc27.x86_64 #1 Hardware name: Gigabyte Technology Co., Ltd. GA-MA790FXT-UD5P/GA-MA790FXT-UD5P, BIOS F6 08/06/2009 task: ffff964eb452ca00 task.stack: ffffb254414dc000 RIP: 0010:0xffffffffc17ba640 RSP: 0018:ffffb254414dfe78 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff964ec1b35890 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000246 RDI: 0000000000000246 RBP: ffffb254414dff00 R08: 000000000000036e R09: ffff964ecfc8dfd0 R10: ffffb254414dfe78 R11: 00000000000f4240 R12: ffff964ec2bf28a0 R13: ffff964ec1b358a8 R14: ffff964ec1b358d0 R15: ffff964ec1b35800 FS: 0000000000000000(0000) GS:ffff964ecfc80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: ffffffffc17ba640 CR3: 000000023058c000 CR4: 00000000000006e0 Call Trace: kthread+0x125/0x140 ? kthread_park+0x60/0x60 ? do_syscall_64+0x67/0x140 ret_from_fork+0x25/0x30 Code: Bad RIP value. RIP: 0xffffffffc17ba640 RSP: ffffb254414dfe78
CR2: ffffffffc17ba640
Note that zilog-rx-i2c-1 should have exited by now, but hasn't due to the missing put in poll().
This code has been replaced completely in kernel v4.16 by a new driver, see commit acaa34bf06e9 ("media: rc: implement zilog transmitter"), and commit f95367a7b758 ("media: staging: remove lirc_zilog driver").
--- drivers/staging/media/lirc/lirc_zilog.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/lirc/lirc_zilog.c +1 -0
@@ -1228,6 +1228,7 @@ static unsigned int poll(struct file *filep, poll_table *wait)dev_dbg (ir->l.dev,"%s result = %s\n" , __func__, ret ?"POLLIN|POLLRDNORM" :"none" ); +put_ir_rx (rx, false);return ret; }
Signature · 1 line
2.14.3