kernel-ark/drivers/staging
Ian Abbott 6cab7a37f5 staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl
`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: c6cd0eefb2 ("staging: comedi: comedi_fops: introduce __comedi_get_user_chanlist()")
Reported-by: Bernd Porr <mail@berndporr.me.uk>
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Bernd Porr <mail@berndporr.me.uk>
Cc: <stable@vger.kernel.org> # 3.15.y 3.16.y 3.17.y
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:56:17 +08:00
..
android Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-10-13 11:28:42 +02:00
bcm Staging: bcm: Removed unnecessary else. 2014-10-02 09:33:46 -07:00
board
comedi staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl 2014-10-20 10:56:17 +08:00
cptm1217
dgap staging: dgap: use dgap_release_remap() in dgap_cleanup_board() 2014-09-23 23:39:25 -07:00
dgnc TTY/Serial driver patches for 3.18-rc1 2014-10-08 06:52:11 -04:00
emxx_udc staging: emxx_udc: Use min_t instead of min 2014-10-02 13:51:03 -07:00
ft1000 staging: ft1000: ft1000-usb: Removed unnecessary else statement. 2014-10-02 10:13:37 -07:00
fwserial
gdm72xx drivers: staging: gdm72xx: Removed unnecessary braces. 2014-09-28 23:27:35 -04:00
gdm724x staging: gdm724x: Removed unnecessary else expression. 2014-09-28 23:27:34 -04:00
goldfish staging: goldfish: avoid multiple assignments 2014-09-06 21:54:57 -07:00
gs_fpgaboot staging: gs_fpgaboot Fix trailing whitespace. 2014-09-19 17:42:15 -07:00
iio Staging: iio: adc: Update Kconfig entries adding module name information 2014-10-02 10:06:10 -07:00
imx-drm Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux 2014-10-14 09:39:08 +02:00
line6 staging: line6: fix midibuf.c coding style issue 2014-09-23 23:41:25 -07:00
lustre Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-10-13 16:23:15 +02:00
media media updates for v3.18-rc1 2014-10-10 22:04:49 -04:00
mt29f_spinand staging/mt29f_spinand: coding style fixes 2014-08-16 12:23:27 -07:00
netlogic staging: netlogic: fix checkpatch.pl "LINE_SPACING" issuses 2014-09-08 14:02:13 -07:00
nvec staging/nvec: Use platform_get_irq() 2014-07-30 17:18:47 -07:00
octeon staging: octeon: Combined seperate strings. 2014-10-02 09:59:20 -07:00
octeon-usb Staging: octeon-hcd: removed dummy label 2014-09-11 14:49:13 -07:00
olpc_dcon
ozwpan staging: ozwpan: Remove typedefs 2014-09-28 22:03:58 -04:00
panel
rtl8188eu staging: r8188eu: replace strnicmp with strncasecmp 2014-10-14 02:18:25 +02:00
rtl8192e staging: rtl8192e: use %*pEn to escape buffer 2014-10-14 02:18:27 +02:00
rtl8192u staging: rtl8192u: use %*pEn to escape buffer 2014-10-14 02:18:27 +02:00
rtl8712 staging: rtl8712: Fixed else not required after return 2014-10-02 11:59:40 -07:00
rtl8723au Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-10-08 21:40:54 -04:00
rts5208 staging: rts5208: remove unnecessary else 2014-10-02 10:07:04 -07:00
skein staging: skein: replace spaces with tabs 2014-09-19 17:27:28 -07:00
slicoss staging: slicoss: Fix void function return statements style warning 2014-09-28 23:36:24 -04:00
speakup staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h> 2014-10-02 10:09:01 -07:00
ste_rmi4 Staging: ste_rmi4: add new line after declarations 2014-09-23 13:44:11 -07:00
unisys staging: unisys: Fix CamelCase in uislib_force_channel_interrupt() 2014-10-02 09:49:29 -07:00
vme Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2014-10-13 11:28:42 +02:00
vt6655 staging: vt6655: Fixed C99 // comment errors in wpactl.c 2014-10-02 10:11:26 -07:00
vt6656 staging: vt6656: Merge three lines into one 2014-09-28 23:22:21 -04:00
wlan-ng staging: wlan-ng: use %*pEhp to print SN 2014-10-14 02:18:27 +02:00
xgifb staging: xgifb: remove unnecessary else 2014-09-06 21:48:19 -07:00
Kconfig staging: et131x: Remove et131x driver from drivers/staging 2014-10-03 13:55:14 -07:00
Makefile staging: et131x: Remove et131x driver from drivers/staging 2014-10-03 13:55:14 -07:00
staging.c