瀏覽代碼

staging: comedi: cb_pcidas64: Fix external_ai_queue_in_use()

`external_ai_queue_in_use()` is supposed to return 1 if the external
channel sequencer is in use by an AI command, else return 0.  If the
"read" subdevice (which is the AI subdevice) is not busy then no AI
command is running so the external channel sequencer is not in use, so
the function should return 0.  Unfortunately, the function's "read"
subdevice busy test is inverted, so the function always returns 0 when
the "read" subdevice is busy.  Worse, if the "read" subdevice is
not busy the subsequent call to `use_internal_queue_6xxx()` results in a
null pointer dereference if a previous AI command used a channel list
with a length greater than 1.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott 7 年之前
父節點
當前提交
9eb7194690
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      drivers/staging/comedi/drivers/cb_pcidas64.c

+ 1 - 1
drivers/staging/comedi/drivers/cb_pcidas64.c

@@ -3251,7 +3251,7 @@ static inline int external_ai_queue_in_use(struct comedi_device *dev)
 {
 	const struct pcidas64_board *board = dev->board_ptr;
 
-	if (dev->read_subdev->busy)
+	if (!dev->read_subdev->busy)
 		return 0;
 	if (board->layout == LAYOUT_4020)
 		return 0;