]> git.karo-electronics.de Git - karo-tx-linux.git/commit
staging: comedi: check s->async for poll(), read() and write()
authorIan Abbott <abbotti@mev.co.uk>
Wed, 27 Feb 2013 10:56:19 +0000 (10:56 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Mar 2013 22:03:39 +0000 (06:03 +0800)
commit9cb9a5913b9217b8ac94d06905a8a27afe3ea0a2
treef287a9f94822c12d3347e44b41c98963c134c037
parent30f3a0a711a2d86050c333b3cd2128fc8e0787f7
staging: comedi: check s->async for poll(), read() and write()

commit cc400e185c07c15a42d2635995f422de5b94b696 upstream.

Some low-level comedi drivers (incorrectly) point `dev->read_subdev` or
`dev->write_subdev` to a subdevice that does not support asynchronous
commands.  Comedi's poll(), read() and write() file operation handlers
assume these subdevices do support asynchronous commands.  In
particular, they assume `s->async` is valid (where `s` points to the
read or write subdevice), which it won't be if it has been set
incorrectly.  This can lead to a NULL pointer dereference.

Check `s->async` is non-NULL in `comedi_poll()`, `comedi_read()` and
`comedi_write()` to avoid the bug.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c