[media] lirc: fix null dereference for tx-only devices
authorSean Young <sean@mess.org>
Fri, 20 Jan 2017 12:10:11 +0000 (10:10 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Jan 2017 09:32:27 +0000 (07:32 -0200)
tx-only RC devices do not have a receive buffer.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/lirc_dev.c

index e0e2297f13d1a0e6f33e944690804c3dbda5fddf..0030ce01babc86dabc92354344d3636c0acc288c 100644 (file)
@@ -468,7 +468,7 @@ int lirc_dev_fop_open(struct inode *inode, struct file *file)
                if (retval) {
                        module_put(cdev->owner);
                        ir->open--;
-               } else {
+               } else if (ir->buf) {
                        lirc_buffer_clear(ir->buf);
                }
                if (ir->task)