diff options
author | Sean Young <sean@mess.org> | 2017-02-01 20:08:56 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-02-03 14:23:36 -0200 |
commit | 32002f725fc708dccc6263b19b56fa3d91626be1 (patch) | |
tree | 27cff6e2d7e5c77020f02dae0777f474aa69efc7 /drivers/media | |
parent | 7a6628b5c321343647bcb8d79cb0d21222597ca5 (diff) |
[media] lirc: cannot read from tx-only device
Bail out early, otherwise we follow a null pointer.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/rc/lirc_dev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 0030ce01babc..a54ca531d8ef 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -647,6 +647,9 @@ ssize_t lirc_dev_fop_read(struct file *file, return -ENODEV; } + if (!LIRC_CAN_REC(ir->d.features)) + return -EINVAL; + dev_dbg(ir->d.dev, LOGHEAD "read called\n", ir->d.name, ir->d.minor); buf = kzalloc(ir->chunk_size, GFP_KERNEL); |