iio: buffer: Fix NULL pointer deref caused by empty scan mask
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 15 Jun 2012 16:08:59 +0000 (18:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Jun 2012 21:39:19 +0000 (14:39 -0700)
commitaff1eb4e3dd13ee419c6cd76baf1bcc2edeaaa86
tree36fbc70e56ffa72bcb33067a178981cb9f841b82
parentfb1c4bcd721fcc30d6e43f60a244483dc0d07056
iio: buffer: Fix NULL pointer deref caused by empty scan mask

iio_scan_mask_match() returns NULL if the passed in scan mask is empty. This
will happen if no channel has been selected and buffer is enabled.
iio_sw_buffer_preenable() will assign NULL to indio_dev->active_scan_mask in
this case. As a result iio_update_demux() will cause a NULL pointer deref,
because it expects active_scan_mask to be non-NULL.

Since it does not make much sense to start data capture if there is no data to
capture this patch updates the code to fail gracefully in iio_scan_mask_match()
instead of crashing the kernel.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/industrialio-buffer.c
This page took 0.028206 seconds and 5 git commands to generate.