2017-11-07 14:58:43 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2015-09-16 17:48:57 -03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-30 11:32:05 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:16 +01:00
|
|
|
|
2013-04-18 14:34:37 -07:00
|
|
|
|
2013-05-17 11:17:00 -07:00
|
|
|
|
2021-11-17 12:05:59 +00:00
|
|
|
|
2012-06-19 10:17:44 +01:00
|
|
|
|
2010-05-03 15:20:29 -07:00
|
|
|
|
2009-03-16 22:05:25 -04:00
|
|
|
|
2014-07-18 14:28:11 -07:00
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-01 13:23:19 +00:00
|
|
|
|
|
|
|
|
|
2013-02-01 13:23:20 +00:00
|
|
|
|
|
|
|
|
|
2015-03-04 12:15:29 -07:00
|
|
|
|
2013-02-01 13:23:20 +00:00
|
|
|
|
2013-02-01 13:23:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-01 13:23:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-24 16:55:14 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-24 16:55:14 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-12 11:57:27 -07:00
|
|
|
|
2012-06-11 17:45:15 -07:00
|
|
|
|
2012-06-12 11:59:55 -07:00
|
|
|
|
2012-06-12 11:57:27 -07:00
|
|
|
|
2012-06-11 17:45:15 -07:00
|
|
|
|
2012-06-12 11:57:45 -07:00
|
|
|
|
|
|
|
|
|
2012-06-12 11:59:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-11 17:45:15 -07:00
|
|
|
|
2012-06-12 11:59:55 -07:00
|
|
|
|
2012-06-12 11:58:27 -07:00
|
|
|
|
2012-06-12 11:59:55 -07:00
|
|
|
|
2012-06-11 17:45:15 -07:00
|
|
|
|
2012-09-05 18:21:25 -07:00
|
|
|
|
2012-06-12 11:59:55 -07:00
|
|
|
|
2012-12-19 17:27:02 -07:00
|
|
|
|
2012-06-12 11:59:55 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-06-11 17:45:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-25 16:03:54 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-25 16:03:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-21 10:19:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-25 16:03:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-08 15:03:26 +00:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2009-03-16 22:05:14 -04:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2019-04-17 15:39:30 +01:00
|
|
|
|
2019-04-17 15:39:29 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2012-09-05 18:21:25 -07:00
|
|
|
|
2015-04-21 13:18:10 +01:00
|
|
|
|
2013-06-11 11:32:29 -07:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-25 16:03:54 -07:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-03-16 22:04:18 -04:00
|
|
|
|
2023-09-13 18:07:02 +01:00
|
|
|
|
|
|
|
|
|
2009-03-16 22:04:18 -04:00
|
|
|
|
2015-02-23 14:57:29 -07:00
|
|
|
|
2010-05-03 15:55:45 -07:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2014-07-29 15:01:20 -07:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2013-04-18 14:31:29 -07:00
|
|
|
|
2013-03-15 13:15:35 +00:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-01 13:23:20 +00:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2013-04-04 14:58:58 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2019-04-17 15:39:29 +01:00
|
|
|
|
2013-11-08 15:03:28 +00:00
|
|
|
|
2013-11-08 15:03:25 +00:00
|
|
|
|
2013-03-15 13:15:33 +00:00
|
|
|
|
2013-11-08 15:03:29 +00:00
|
|
|
|
2010-02-26 17:37:00 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2013-11-08 15:03:26 +00:00
|
|
|
|
2013-11-08 15:03:25 +00:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-10-03 14:56:02 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-25 16:03:54 -07:00
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-08-25 16:03:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-10 11:49:00 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-10 11:49:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-06 09:31:35 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-06 09:31:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-07 13:15:55 +01:00
|
|
|
|
2013-08-06 09:31:35 -07:00
|
|
|
|
2025-07-07 13:15:55 +01:00
|
|
|
|
|
|
|
|
|
2013-08-06 09:31:35 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-30 11:04:56 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-30 11:04:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-07 13:15:55 +01:00
|
|
|
|
2013-08-30 11:04:56 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
`ni_cdio_cmdtest()` validates Comedi asynchronous commands for the DIO
subdevice (subdevice 2) of supported National Instruments M-series
cards. It is called when handling the `COMEDI_CMD` and `COMEDI_CMDTEST`
ioctls for this subdevice. There are two causes for a possible
divide-by-zero error when validating that the `stop_arg` member of the
passed-in command is not too large.
The first cause for the divide-by-zero is that calls to
`comedi_bytes_per_scan()` are only valid once the command has been
copied to `s->async->cmd`, but that copy is only done for the
`COMEDI_CMD` ioctl. For the `COMEDI_CMDTEST` ioctl, it will use
whatever was left there by the previous `COMEDI_CMD` ioctl, if any.
(This is very likely, as it is usual for the application to use
`COMEDI_CMDTEST` before `COMEDI_CMD`.) If there has been no previous,
valid `COMEDI_CMD` for this subdevice, then `comedi_bytes_per_scan()`
will return 0, so the subsequent division in `ni_cdio_cmdtest()` of
`s->async->prealloc_bufsz / comedi_bytes_per_scan(s)` will be a
divide-by-zero error. To fix this error, call a new function
`comedi_bytes_per_scan_cmd(s, cmd)`, based on the existing
`comedi_bytes_per_scan(s)` but using a specified `struct comedi_cmd` for
its calculations. (Also refactor `comedi_bytes_per_scan()` to call the
new function.)
Once the first cause for the divide-by-zero has been fixed, the second
cause is that `comedi_bytes_per_scan_cmd()` can legitimately return 0 if
the `scan_end_arg` member of the `struct comedi_cmd` being tested is 0.
Fix it by only performing the division (and validating that `stop_arg`
is no more than the maximum value) if `comedi_bytes_per_scan_cmd()`
returns a non-zero value.
The problem was reported on the COMEDI mailing list here:
https://groups.google.com/forum/#!topic/comedi_list/4t9WlHzMhKM
Reported-by: Ivan Vasilyev <grabesstimme@gmail.com>
Tested-by: Ivan Vasilyev <grabesstimme@gmail.com>
Fixes: f164cbf98fa8 ("staging: comedi: ni_mio_common: add finite regeneration to dio output")
Cc: <stable@vger.kernel.org> # 4.6+
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-04 14:33:54 +00:00
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
`ni_cdio_cmdtest()` validates Comedi asynchronous commands for the DIO
subdevice (subdevice 2) of supported National Instruments M-series
cards. It is called when handling the `COMEDI_CMD` and `COMEDI_CMDTEST`
ioctls for this subdevice. There are two causes for a possible
divide-by-zero error when validating that the `stop_arg` member of the
passed-in command is not too large.
The first cause for the divide-by-zero is that calls to
`comedi_bytes_per_scan()` are only valid once the command has been
copied to `s->async->cmd`, but that copy is only done for the
`COMEDI_CMD` ioctl. For the `COMEDI_CMDTEST` ioctl, it will use
whatever was left there by the previous `COMEDI_CMD` ioctl, if any.
(This is very likely, as it is usual for the application to use
`COMEDI_CMDTEST` before `COMEDI_CMD`.) If there has been no previous,
valid `COMEDI_CMD` for this subdevice, then `comedi_bytes_per_scan()`
will return 0, so the subsequent division in `ni_cdio_cmdtest()` of
`s->async->prealloc_bufsz / comedi_bytes_per_scan(s)` will be a
divide-by-zero error. To fix this error, call a new function
`comedi_bytes_per_scan_cmd(s, cmd)`, based on the existing
`comedi_bytes_per_scan(s)` but using a specified `struct comedi_cmd` for
its calculations. (Also refactor `comedi_bytes_per_scan()` to call the
new function.)
Once the first cause for the divide-by-zero has been fixed, the second
cause is that `comedi_bytes_per_scan_cmd()` can legitimately return 0 if
the `scan_end_arg` member of the `struct comedi_cmd` being tested is 0.
Fix it by only performing the division (and validating that `stop_arg`
is no more than the maximum value) if `comedi_bytes_per_scan_cmd()`
returns a non-zero value.
The problem was reported on the COMEDI mailing list here:
https://groups.google.com/forum/#!topic/comedi_list/4t9WlHzMhKM
Reported-by: Ivan Vasilyev <grabesstimme@gmail.com>
Tested-by: Ivan Vasilyev <grabesstimme@gmail.com>
Fixes: f164cbf98fa8 ("staging: comedi: ni_mio_common: add finite regeneration to dio output")
Cc: <stable@vger.kernel.org> # 4.6+
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-04 14:33:54 +00:00
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
|
|
|
|
|
staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
`ni_cdio_cmdtest()` validates Comedi asynchronous commands for the DIO
subdevice (subdevice 2) of supported National Instruments M-series
cards. It is called when handling the `COMEDI_CMD` and `COMEDI_CMDTEST`
ioctls for this subdevice. There are two causes for a possible
divide-by-zero error when validating that the `stop_arg` member of the
passed-in command is not too large.
The first cause for the divide-by-zero is that calls to
`comedi_bytes_per_scan()` are only valid once the command has been
copied to `s->async->cmd`, but that copy is only done for the
`COMEDI_CMD` ioctl. For the `COMEDI_CMDTEST` ioctl, it will use
whatever was left there by the previous `COMEDI_CMD` ioctl, if any.
(This is very likely, as it is usual for the application to use
`COMEDI_CMDTEST` before `COMEDI_CMD`.) If there has been no previous,
valid `COMEDI_CMD` for this subdevice, then `comedi_bytes_per_scan()`
will return 0, so the subsequent division in `ni_cdio_cmdtest()` of
`s->async->prealloc_bufsz / comedi_bytes_per_scan(s)` will be a
divide-by-zero error. To fix this error, call a new function
`comedi_bytes_per_scan_cmd(s, cmd)`, based on the existing
`comedi_bytes_per_scan(s)` but using a specified `struct comedi_cmd` for
its calculations. (Also refactor `comedi_bytes_per_scan()` to call the
new function.)
Once the first cause for the divide-by-zero has been fixed, the second
cause is that `comedi_bytes_per_scan_cmd()` can legitimately return 0 if
the `scan_end_arg` member of the `struct comedi_cmd` being tested is 0.
Fix it by only performing the division (and validating that `stop_arg`
is no more than the maximum value) if `comedi_bytes_per_scan_cmd()`
returns a non-zero value.
The problem was reported on the COMEDI mailing list here:
https://groups.google.com/forum/#!topic/comedi_list/4t9WlHzMhKM
Reported-by: Ivan Vasilyev <grabesstimme@gmail.com>
Tested-by: Ivan Vasilyev <grabesstimme@gmail.com>
Fixes: f164cbf98fa8 ("staging: comedi: ni_mio_common: add finite regeneration to dio output")
Cc: <stable@vger.kernel.org> # 4.6+
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-04 14:33:54 +00:00
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
`ni_cdio_cmdtest()` validates Comedi asynchronous commands for the DIO
subdevice (subdevice 2) of supported National Instruments M-series
cards. It is called when handling the `COMEDI_CMD` and `COMEDI_CMDTEST`
ioctls for this subdevice. There are two causes for a possible
divide-by-zero error when validating that the `stop_arg` member of the
passed-in command is not too large.
The first cause for the divide-by-zero is that calls to
`comedi_bytes_per_scan()` are only valid once the command has been
copied to `s->async->cmd`, but that copy is only done for the
`COMEDI_CMD` ioctl. For the `COMEDI_CMDTEST` ioctl, it will use
whatever was left there by the previous `COMEDI_CMD` ioctl, if any.
(This is very likely, as it is usual for the application to use
`COMEDI_CMDTEST` before `COMEDI_CMD`.) If there has been no previous,
valid `COMEDI_CMD` for this subdevice, then `comedi_bytes_per_scan()`
will return 0, so the subsequent division in `ni_cdio_cmdtest()` of
`s->async->prealloc_bufsz / comedi_bytes_per_scan(s)` will be a
divide-by-zero error. To fix this error, call a new function
`comedi_bytes_per_scan_cmd(s, cmd)`, based on the existing
`comedi_bytes_per_scan(s)` but using a specified `struct comedi_cmd` for
its calculations. (Also refactor `comedi_bytes_per_scan()` to call the
new function.)
Once the first cause for the divide-by-zero has been fixed, the second
cause is that `comedi_bytes_per_scan_cmd()` can legitimately return 0 if
the `scan_end_arg` member of the `struct comedi_cmd` being tested is 0.
Fix it by only performing the division (and validating that `stop_arg`
is no more than the maximum value) if `comedi_bytes_per_scan_cmd()`
returns a non-zero value.
The problem was reported on the COMEDI mailing list here:
https://groups.google.com/forum/#!topic/comedi_list/4t9WlHzMhKM
Reported-by: Ivan Vasilyev <grabesstimme@gmail.com>
Tested-by: Ivan Vasilyev <grabesstimme@gmail.com>
Fixes: f164cbf98fa8 ("staging: comedi: ni_mio_common: add finite regeneration to dio output")
Cc: <stable@vger.kernel.org> # 4.6+
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-04 14:33:54 +00:00
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-31 12:04:28 -07:00
|
|
|
|
2014-11-12 16:00:48 +00:00
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
|
|
|
|
|
2014-11-12 16:00:48 +00:00
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
|
|
|
|
|
2014-10-31 12:04:28 -07:00
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
staging: comedi: ni_mio_common: Fix divide-by-zero for DIO cmdtest
`ni_cdio_cmdtest()` validates Comedi asynchronous commands for the DIO
subdevice (subdevice 2) of supported National Instruments M-series
cards. It is called when handling the `COMEDI_CMD` and `COMEDI_CMDTEST`
ioctls for this subdevice. There are two causes for a possible
divide-by-zero error when validating that the `stop_arg` member of the
passed-in command is not too large.
The first cause for the divide-by-zero is that calls to
`comedi_bytes_per_scan()` are only valid once the command has been
copied to `s->async->cmd`, but that copy is only done for the
`COMEDI_CMD` ioctl. For the `COMEDI_CMDTEST` ioctl, it will use
whatever was left there by the previous `COMEDI_CMD` ioctl, if any.
(This is very likely, as it is usual for the application to use
`COMEDI_CMDTEST` before `COMEDI_CMD`.) If there has been no previous,
valid `COMEDI_CMD` for this subdevice, then `comedi_bytes_per_scan()`
will return 0, so the subsequent division in `ni_cdio_cmdtest()` of
`s->async->prealloc_bufsz / comedi_bytes_per_scan(s)` will be a
divide-by-zero error. To fix this error, call a new function
`comedi_bytes_per_scan_cmd(s, cmd)`, based on the existing
`comedi_bytes_per_scan(s)` but using a specified `struct comedi_cmd` for
its calculations. (Also refactor `comedi_bytes_per_scan()` to call the
new function.)
Once the first cause for the divide-by-zero has been fixed, the second
cause is that `comedi_bytes_per_scan_cmd()` can legitimately return 0 if
the `scan_end_arg` member of the `struct comedi_cmd` being tested is 0.
Fix it by only performing the division (and validating that `stop_arg`
is no more than the maximum value) if `comedi_bytes_per_scan_cmd()`
returns a non-zero value.
The problem was reported on the COMEDI mailing list here:
https://groups.google.com/forum/#!topic/comedi_list/4t9WlHzMhKM
Reported-by: Ivan Vasilyev <grabesstimme@gmail.com>
Tested-by: Ivan Vasilyev <grabesstimme@gmail.com>
Fixes: f164cbf98fa8 ("staging: comedi: ni_mio_common: add finite regeneration to dio output")
Cc: <stable@vger.kernel.org> # 4.6+
Cc: Spencer E. Olson <olsonse@umich.edu>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-04 14:33:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:57 +01:00
|
|
|
|
|
|
|
|
|
staging: comedi: fix extreme case of comedi_nsamples_left()
`comedi_nsamples_left(s, nsamples)` returns the number of samples
remaining to complete an asynchronous command or the passed in
`nsamples`, whichever is lower. However, it goes wrong in the extreme
case of setting the `nsamples` parameter to `UINT_MAX` when the number
of conversions per "scan" (`s->async->cmd.scan_end_arg`) is 1. It uses
`comedi_nscans_remaining(s, nscans)` to determine the number of scans
remaining, or the parameter `nscans`, whichever is lower. To determine
the parameter `nscans`, it divides `nsamples` by the number of
conversions per scan and adds 1. The addition of 1 is to avoid setting
the parameter `nscans` to 0, as `comedi_nscans_remaining(s, nscans)`
treats that value specially. However in the extreme case where
`nsamples` is `UINT_MAX` and the number of samples per scan is 1, the
addition of 1 to `nscans` overflows, producing the unwanted 0.
Fix it by refactoring new a function `__comedi_nscans_remaining(s,
nscans)` out of `comedi_nscans_remaining(s, nscans)`. The new function
does everything except the special handling when `nscans` is 0. Change
`comedi_nsamples_remaining()` to call the new function without adding 1
to `nscans` to avoid the overflow.
This overflow bug doesn't affect any of the current COMEDI drivers. I
stumbled across it while changing to one of the drivers.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-23 10:56:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:29 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:29 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:29 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:29 -07:00
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
2014-11-05 10:31:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
staging: comedi: fix extreme case of comedi_nsamples_left()
`comedi_nsamples_left(s, nsamples)` returns the number of samples
remaining to complete an asynchronous command or the passed in
`nsamples`, whichever is lower. However, it goes wrong in the extreme
case of setting the `nsamples` parameter to `UINT_MAX` when the number
of conversions per "scan" (`s->async->cmd.scan_end_arg`) is 1. It uses
`comedi_nscans_remaining(s, nscans)` to determine the number of scans
remaining, or the parameter `nscans`, whichever is lower. To determine
the parameter `nscans`, it divides `nsamples` by the number of
conversions per scan and adds 1. The addition of 1 is to avoid setting
the parameter `nscans` to 0, as `comedi_nscans_remaining(s, nscans)`
treats that value specially. However in the extreme case where
`nsamples` is `UINT_MAX` and the number of samples per scan is 1, the
addition of 1 to `nscans` overflows, producing the unwanted 0.
Fix it by refactoring new a function `__comedi_nscans_remaining(s,
nscans)` out of `comedi_nscans_remaining(s, nscans)`. The new function
does everything except the special handling when `nscans` is 0. Change
`comedi_nsamples_remaining()` to call the new function without adding 1
to `nscans` to avoid the overflow.
This overflow bug doesn't affect any of the current COMEDI drivers. I
stumbled across it while changing to one of the drivers.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-10-23 10:56:09 +01:00
|
|
|
|
2014-11-05 10:31:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:33 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:33 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-06-13 19:14:35 +02:00
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:33 -07:00
|
|
|
|
2018-06-13 19:14:35 +02:00
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:33 -07:00
|
|
|
|
2018-06-13 19:14:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:33 -07:00
|
|
|
|
2018-06-13 19:14:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-11-05 10:31:33 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:59 +01:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:59 +01:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
2014-09-15 13:45:59 +01:00
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
2014-09-15 13:45:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-31 09:49:31 -07:00
|
|
|
|
2014-09-15 13:45:59 +01:00
|
|
|
|
|
|
|
|
|
2014-10-31 09:49:31 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:59 +01:00
|
|
|
|
|
|
|
|
|
2014-11-05 10:20:52 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:45:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:46:01 +01:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-09-15 13:46:01 +01:00
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
2014-09-15 13:46:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-30 10:47:25 -07:00
|
|
|
|
2014-09-15 13:46:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
2016-03-30 10:47:24 -07:00
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
2016-03-30 10:47:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
comedi: Fix use of uninitialized data in insn_rw_emulate_bits()
commit e9cb26291d009243a4478a7ffb37b3a9175bfce9 upstream.
For Comedi `INSN_READ` and `INSN_WRITE` instructions on "digital"
subdevices (subdevice types `COMEDI_SUBD_DI`, `COMEDI_SUBD_DO`, and
`COMEDI_SUBD_DIO`), it is common for the subdevice driver not to have
`insn_read` and `insn_write` handler functions, but to have an
`insn_bits` handler function for handling Comedi `INSN_BITS`
instructions. In that case, the subdevice's `insn_read` and/or
`insn_write` function handler pointers are set to point to the
`insn_rw_emulate_bits()` function by `__comedi_device_postconfig()`.
For `INSN_WRITE`, `insn_rw_emulate_bits()` currently assumes that the
supplied `data[0]` value is a valid copy from user memory. It will at
least exist because `do_insnlist_ioctl()` and `do_insn_ioctl()` in
"comedi_fops.c" ensure at lease `MIN_SAMPLES` (16) elements are
allocated. However, if `insn->n` is 0 (which is allowable for
`INSN_READ` and `INSN_WRITE` instructions, then `data[0]` may contain
uninitialized data, and certainly contains invalid data, possibly from a
different instruction in the array of instructions handled by
`do_insnlist_ioctl()`. This will result in an incorrect value being
written to the digital output channel (or to the digital input/output
channel if configured as an output), and may be reflected in the
internal saved state of the channel.
Fix it by returning 0 early if `insn->n` is 0, before reaching the code
that accesses `data[0]`. Previously, the function always returned 1 on
success, but it is supposed to be the number of data samples actually
read or written up to `insn->n`, which is 0 in this case.
Reported-by: syzbot+cb96ec476fb4914445c9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=cb96ec476fb4914445c9
Fixes: ed9eccbe8970 ("Staging: add comedi core")
Cc: stable@vger.kernel.org # 5.13+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20250707153355.82474-1-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-07 16:33:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-30 10:47:24 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-07 13:15:55 +01:00
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
2016-03-30 10:47:24 -07:00
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-30 10:47:24 -07:00
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
2019-04-17 15:39:29 +01:00
|
|
|
|
2013-01-21 14:37:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-03-30 10:47:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
|
|
|
|
|
2013-02-11 09:41:29 -08:00
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
2013-02-11 09:41:29 -08:00
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-07-21 11:48:32 -07:00
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-02-01 10:20:30 +00:00
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-17 15:39:29 +01:00
|
|
|
|
2018-10-03 14:56:02 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-08-30 10:47:03 -07:00
|
|
|
|
|
|
|
|
|
2025-07-07 13:15:55 +01:00
|
|
|
|
2013-08-30 10:47:03 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-04 14:58:56 +01:00
|
|
|
|
|
|
|
|
|
2019-04-17 15:39:29 +01:00
|
|
|
|
2013-04-04 14:58:56 +01:00
|
|
|
|
2013-04-08 10:56:02 -07:00
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
2013-11-08 15:03:25 +00:00
|
|
|
|
2013-03-15 13:15:33 +00:00
|
|
|
|
2013-11-08 15:03:25 +00:00
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-21 14:36:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-17 11:17:00 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-17 11:17:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-17 11:18:01 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-17 11:17:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-05-17 11:18:01 -07:00
|
|
|
|
2013-05-17 11:17:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-13 15:16:06 +08:00
|
|
|
|
2013-05-17 11:17:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-09 16:05:54 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-09 16:05:54 -07:00
|
|
|
|
2013-04-09 16:30:11 -07:00
|
|
|
|
|
|
|
|
|
2013-04-09 16:05:54 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-09 16:30:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-09 16:30:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-18 14:31:29 -07:00
|
|
|
|
2013-04-09 16:30:11 -07:00
|
|
|
|
2013-04-18 14:31:29 -07:00
|
|
|
|
|
|
|
|
|
2013-04-09 16:30:11 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-09 16:05:54 -07:00
|
|
|
|
|
|
|
|
|
2013-04-18 14:31:29 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-18 14:31:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-18 14:34:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-18 14:31:29 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-03-16 22:06:20 -04:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2009-03-16 22:05:25 -04:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2019-04-17 15:39:29 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2012-09-11 17:56:42 +03:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
|
|
|
|
|
2014-07-18 14:28:11 -07:00
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
2014-07-18 14:28:11 -07:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2015-03-04 12:15:29 -07:00
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-09-11 17:56:42 +03:00
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
|
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
2015-03-04 12:15:29 -07:00
|
|
|
|
2012-08-15 15:02:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2015-08-05 01:18:46 +08:00
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
2012-08-15 15:02:45 +01:00
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
2013-04-08 10:55:29 -07:00
|
|
|
|
|
|
|
|
|
2012-03-30 17:15:00 +01:00
|
|
|
|
2013-04-04 14:58:59 +01:00
|
|
|
|
|
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2013-04-04 14:58:58 +01:00
|
|
|
|
2013-08-23 12:37:17 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2013-04-04 14:58:56 +01:00
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
|
|
|
|
|
2013-04-04 14:58:56 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 13:10:38 +00:00
|
|
|
|
|
|
|
|
|
staging: comedi: add bus-type-specific attach hooks for PCI and USB
The Comedi auto-configuration mechanism used to bind hardware devices to
comedi devices automatically is pretty kludgy. It fakes a "manual"
configuration of the comedi device as though the COMEDI_DEVCONFIG ioctl
(or the 'comedi_config' utility) were used. In particular, the
low-level comedi driver's '->attach()' routine is called with a pointer
to the struct comedi_device being attached and a pointer to a 'struct
devconfig' containing a device name string and a few integer options to
help the attach routine locate the device being attached. In the case
of PCI devices, these integer options are the PCI bus and slot numbers.
In the case of USB devices, there are no integer options and it relies
more on pot luck to attach the correct device.
This patch adds a couple of bus-type-specific attach routine hooks to
the struct comedi_driver, which a low-level driver can optionally fill
in if it supports auto-configuration.
A low-level driver that supports auto-configuration of {PCI,USB} devices
calls the existing comedi_{pci,usb}_auto_config() when it wishes to
auto-configure a freshly probed device (maybe after loading firmware).
This will call the new '->attach_{pci,usb}()' hook if the driver has
defined it, otherwise it will fall back to calling the '->attach()' hook
as before. The '->attach_{pci,usb}()' hook gets a pointer to the struct
comedi_device and a pointer to the struct {pci_dev,usb_interface} and
can figure out the {PCI,USB} device details for itself.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-30 17:15:01 +01:00
|
|
|
|
2013-04-08 10:55:05 -07:00
|
|
|
|
staging: comedi: add bus-type-specific attach hooks for PCI and USB
The Comedi auto-configuration mechanism used to bind hardware devices to
comedi devices automatically is pretty kludgy. It fakes a "manual"
configuration of the comedi device as though the COMEDI_DEVCONFIG ioctl
(or the 'comedi_config' utility) were used. In particular, the
low-level comedi driver's '->attach()' routine is called with a pointer
to the struct comedi_device being attached and a pointer to a 'struct
devconfig' containing a device name string and a few integer options to
help the attach routine locate the device being attached. In the case
of PCI devices, these integer options are the PCI bus and slot numbers.
In the case of USB devices, there are no integer options and it relies
more on pot luck to attach the correct device.
This patch adds a couple of bus-type-specific attach routine hooks to
the struct comedi_driver, which a low-level driver can optionally fill
in if it supports auto-configuration.
A low-level driver that supports auto-configuration of {PCI,USB} devices
calls the existing comedi_{pci,usb}_auto_config() when it wishes to
auto-configure a freshly probed device (maybe after loading firmware).
This will call the new '->attach_{pci,usb}()' hook if the driver has
defined it, otherwise it will fall back to calling the '->attach()' hook
as before. The '->attach_{pci,usb}()' hook gets a pointer to the struct
comedi_device and a pointer to the struct {pci_dev,usb_interface} and
can figure out the {PCI,USB} device details for itself.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-30 17:15:01 +01:00
|
|
|
|
|
|
|
|
|
2013-04-04 14:58:42 +01:00
|
|
|
|
2017-08-28 15:01:32 +02:00
|
|
|
|
2013-04-04 14:58:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-08-28 15:01:32 +02:00
|
|
|
|
2013-04-04 14:58:42 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-11-14 13:10:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-08 10:55:05 -07:00
|
|
|
|
2014-01-07 21:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-08 10:55:05 -07:00
|
|
|
|
2014-01-07 21:42:25 +00:00
|
|
|
|
2013-04-08 10:55:05 -07:00
|
|
|
|
2019-04-17 15:39:29 +01:00
|
|
|
|
staging: comedi: add bus-type-specific attach hooks for PCI and USB
The Comedi auto-configuration mechanism used to bind hardware devices to
comedi devices automatically is pretty kludgy. It fakes a "manual"
configuration of the comedi device as though the COMEDI_DEVCONFIG ioctl
(or the 'comedi_config' utility) were used. In particular, the
low-level comedi driver's '->attach()' routine is called with a pointer
to the struct comedi_device being attached and a pointer to a 'struct
devconfig' containing a device name string and a few integer options to
help the attach routine locate the device being attached. In the case
of PCI devices, these integer options are the PCI bus and slot numbers.
In the case of USB devices, there are no integer options and it relies
more on pot luck to attach the correct device.
This patch adds a couple of bus-type-specific attach routine hooks to
the struct comedi_driver, which a low-level driver can optionally fill
in if it supports auto-configuration.
A low-level driver that supports auto-configuration of {PCI,USB} devices
calls the existing comedi_{pci,usb}_auto_config() when it wishes to
auto-configure a freshly probed device (maybe after loading firmware).
This will call the new '->attach_{pci,usb}()' hook if the driver has
defined it, otherwise it will fall back to calling the '->attach()' hook
as before. The '->attach_{pci,usb}()' hook gets a pointer to the struct
comedi_device and a pointer to the struct {pci_dev,usb_interface} and
can figure out the {PCI,USB} device details for itself.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-30 17:15:01 +01:00
|
|
|
|
2013-04-08 10:55:05 -07:00
|
|
|
|
2013-04-08 10:55:29 -07:00
|
|
|
|
2013-04-08 10:55:05 -07:00
|
|
|
|
2013-04-04 14:58:59 +01:00
|
|
|
|
2013-04-08 10:55:05 -07:00
|
|
|
|
staging: comedi: add bus-type-specific attach hooks for PCI and USB
The Comedi auto-configuration mechanism used to bind hardware devices to
comedi devices automatically is pretty kludgy. It fakes a "manual"
configuration of the comedi device as though the COMEDI_DEVCONFIG ioctl
(or the 'comedi_config' utility) were used. In particular, the
low-level comedi driver's '->attach()' routine is called with a pointer
to the struct comedi_device being attached and a pointer to a 'struct
devconfig' containing a device name string and a few integer options to
help the attach routine locate the device being attached. In the case
of PCI devices, these integer options are the PCI bus and slot numbers.
In the case of USB devices, there are no integer options and it relies
more on pot luck to attach the correct device.
This patch adds a couple of bus-type-specific attach routine hooks to
the struct comedi_driver, which a low-level driver can optionally fill
in if it supports auto-configuration.
A low-level driver that supports auto-configuration of {PCI,USB} devices
calls the existing comedi_{pci,usb}_auto_config() when it wishes to
auto-configure a freshly probed device (maybe after loading firmware).
This will call the new '->attach_{pci,usb}()' hook if the driver has
defined it, otherwise it will fall back to calling the '->attach()' hook
as before. The '->attach_{pci,usb}()' hook gets a pointer to the struct
comedi_device and a pointer to the struct {pci_dev,usb_interface} and
can figure out the {PCI,USB} device details for itself.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-30 17:15:01 +01:00
|
|
|
|
2014-01-07 21:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-17 15:35:31 +01:00
|
|
|
|
2013-04-04 14:58:48 +01:00
|
|
|
|
2014-01-07 21:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-04-17 15:35:31 +01:00
|
|
|
|
2014-01-07 21:42:25 +00:00
|
|
|
|
staging: comedi: add bus-type-specific attach hooks for PCI and USB
The Comedi auto-configuration mechanism used to bind hardware devices to
comedi devices automatically is pretty kludgy. It fakes a "manual"
configuration of the comedi device as though the COMEDI_DEVCONFIG ioctl
(or the 'comedi_config' utility) were used. In particular, the
low-level comedi driver's '->attach()' routine is called with a pointer
to the struct comedi_device being attached and a pointer to a 'struct
devconfig' containing a device name string and a few integer options to
help the attach routine locate the device being attached. In the case
of PCI devices, these integer options are the PCI bus and slot numbers.
In the case of USB devices, there are no integer options and it relies
more on pot luck to attach the correct device.
This patch adds a couple of bus-type-specific attach routine hooks to
the struct comedi_driver, which a low-level driver can optionally fill
in if it supports auto-configuration.
A low-level driver that supports auto-configuration of {PCI,USB} devices
calls the existing comedi_{pci,usb}_auto_config() when it wishes to
auto-configure a freshly probed device (maybe after loading firmware).
This will call the new '->attach_{pci,usb}()' hook if the driver has
defined it, otherwise it will fall back to calling the '->attach()' hook
as before. The '->attach_{pci,usb}()' hook gets a pointer to the struct
comedi_device and a pointer to the struct {pci_dev,usb_interface} and
can figure out the {PCI,USB} device details for itself.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-30 17:15:01 +01:00
|
|
|
|
|
|
|
|
|
2012-10-27 21:44:14 +01:00
|
|
|
|
|
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-27 21:44:14 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2015-03-04 12:15:29 -07:00
|
|
|
|
2009-06-08 21:04:41 +05:30
|
|
|
|
2013-04-04 14:58:47 +01:00
|
|
|
|
2008-11-04 20:29:31 -08:00
|
|
|
|
2012-10-27 21:44:14 +01:00
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
|
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
|
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-04-12 10:11:54 -07:00
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
2015-09-17 17:19:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-27 14:50:57 +01:00
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-27 14:50:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
|
|
|
|
|
2013-11-08 15:03:35 +00:00
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-08 15:03:35 +00:00
|
|
|
|
2013-01-30 15:24:38 -07:00
|
|
|
|
|
|
|
|
|
2013-04-12 10:11:54 -07:00
|
|
|
|