6cab7a37f5
`do_cmd_ioctl()`, the handler for the `COMEDI_CMD` ioctl can incorrectly
call the Comedi subdevice's `do_cmd()` handler with a NULL channel list
pointer. This is a regression as the `do_cmd()` handler has never been
expected to deal with that, leading to a kernel OOPS when it tries to
dereference it.
A NULL channel list pointer is allowed for the `COMEDI_CMDTEST` ioctl,
handled by `do_cmdtest_ioctl()` and the subdevice's `do_cmdtest()`
handler, but not for the `COMEDI_CMD` ioctl and its handlers.
Both `do_cmd_ioctl()` and `do_cmdtest_ioctl()` call
`__comedi_get_user_chanlist()` to copy the channel list from user memory
into dynamically allocated kernel memory and check it for consistency.
That function currently returns 0 if the `user_chanlist` parameter
(pointing to the channel list in user memory) is NULL. That's fine for
`do_cmdtest_ioctl()`, but `do_cmd_ioctl()` incorrectly assumes the
kernel copy of the channel list has been set-up correctly.
Fix it by not allowing the `user_chanlist` parameter to be NULL in
`__comedi_get_user_chanlist()`, and only calling it from
`do_cmdtest_ioctl()` if the parameter is non-NULL.
Thanks to Bernd Porr for reporting the bug via an initial patch sent
privately.
Fixes:
|
||
---|---|---|
.. | ||
android | ||
bcm | ||
board | ||
comedi | ||
cptm1217 | ||
dgap | ||
dgnc | ||
emxx_udc | ||
ft1000 | ||
fwserial | ||
gdm72xx | ||
gdm724x | ||
goldfish | ||
gs_fpgaboot | ||
iio | ||
imx-drm | ||
line6 | ||
lustre | ||
media | ||
mt29f_spinand | ||
netlogic | ||
nvec | ||
octeon | ||
octeon-usb | ||
olpc_dcon | ||
ozwpan | ||
panel | ||
rtl8188eu | ||
rtl8192e | ||
rtl8192u | ||
rtl8712 | ||
rtl8723au | ||
rts5208 | ||
skein | ||
slicoss | ||
speakup | ||
ste_rmi4 | ||
unisys | ||
vme | ||
vt6655 | ||
vt6656 | ||
wlan-ng | ||
xgifb | ||
Kconfig | ||
Makefile | ||
staging.c |