瀏覽代碼

[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>
Sean Young 8 年之前
父節點
當前提交
32002f725f
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/media/rc/lirc_dev.c

+ 3 - 0
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);