linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [media] lirc: cannot read from tx-only device
@ 2017-02-02 23:14 Sean Young
  2017-02-02 23:14 ` [PATCH] [media] mce_kbd: add missing keys from UK layout Sean Young
  0 siblings, 1 reply; 2+ messages in thread
From: Sean Young @ 2017-02-02 23:14 UTC (permalink / raw)
  To: linux-media

Bail out early, otherwise we follow a null pointer.

Signed-off-by: Sean Young <sean@mess.org>
---
 drivers/media/rc/lirc_dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index 0030ce0..a54ca53 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);
-- 
2.9.3


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

end of thread, other threads:[~2017-02-02 23:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-02 23:14 [PATCH] [media] lirc: cannot read from tx-only device Sean Young
2017-02-02 23:14 ` [PATCH] [media] mce_kbd: add missing keys from UK layout Sean Young

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