]> git.baikalelectronics.ru Git - kernel.git/commit
staging: comedi: dt282x: fix a null pointer deref on interrupt
authorIan Abbott <abbotti@mev.co.uk>
Wed, 26 Jun 2019 13:18:04 +0000 (14:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jul 2019 06:50:15 +0000 (08:50 +0200)
commit16e98401f67ea5052c1b2e90389d657e18492c37
treedb7522e56bfbad02e40ab9333da0f373ed8b716a
parent09254e47cdcf175b4c0957d24b4f88ed75c9b6d2
staging: comedi: dt282x: fix a null pointer deref on interrupt

The interrupt handler `dt282x_interrupt()` causes a null pointer
dereference for those supported boards that have no analog output
support.  For these boards, `dev->write_subdev` will be `NULL` and
therefore the `s_ao` subdevice pointer variable will be `NULL`.  In that
case, the following call near the end of the interrupt handler results
in a null pointer dereference:

comedi_handle_events(dev, s_ao);

Fix it by only calling the above function if `s_ao` is valid.

(There are other uses of `s_ao` by the interrupt handler that may or may
not be reached depending on values of hardware registers.  Trust that
they are reliable for now.)

Note:
commit 1ec9f0303f2a ("staging: comedi: dt282x: use comedi_handle_events()")
propagates an earlier error from
commit d7891869d90d ("staging: comedi: dt282x: use cfc_handle_events()").

Fixes: 1ec9f0303f2a ("staging: comedi: dt282x: use comedi_handle_events()")
Cc: <stable@vger.kernel.org> # v3.19+
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/dt282x.c