linux/drivers/iio/adc
Jonathan Cameron 39e91f3be4 iio:adc:ti-adc0832 Fix alignment issue with timestamp
One of a class of bugs pointed out by Lars in a recent review.
iio_push_to_buffers_with_timestamp assumes the buffer used is aligned
to the size of the timestamp (8 bytes).  This is not guaranteed in
this driver which uses an array of smaller elements on the stack.

We fix this issues by moving to a suitable structure in the iio_priv()
data with alignment explicitly requested.  This data is allocated
with kzalloc so no data can leak apart from previous readings.
Note that previously no data could leak 'including' previous readings
but I don't think it is an issue to potentially leak them like
this now does.

In this case the postioning of the timestamp is depends on what
other channels are enabled. As such we cannot use a structure to
make the alignment explicit as it would be missleading by suggesting
only one possible location for the timestamp.

Fixes: 815bbc8746 ("iio: ti-adc0832: add triggered buffer support")
Reported-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20200722155103.979802-25-jic23@kernel.org
2020-09-21 20:01:51 +01:00
..
ab8500-gpadc.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
ad799x.c iio: adc: ad799x: Demote seemingly unintentional kerneldoc header 2020-07-20 09:03:20 +01:00
ad7091r5.c iio: adc: ad7091r5: Add scale and external VREF support 2019-11-16 17:06:10 +00:00
ad7091r-base.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ad7091r-base.h iio: adc: ad7091r5: Add scale and external VREF support 2019-11-16 17:06:10 +00:00
ad7124.c iio: adc: ad7124: move chip ID & name on the chip_info table 2020-07-22 14:36:05 +01:00
ad7192.c iio: adc: ad7192: move ad7192_of_match table closer to the end of the file 2020-07-20 09:03:37 +01:00
ad7266.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
ad7291.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
ad7292.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ad7298.c iio: adc: ad7298: Demote obvious misuse of kerneldoc to standard comment blocks 2020-07-20 09:02:49 +01:00
ad7476.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
ad7606_par.c iio: Remove dev_err() usage after platform_get_irq() 2019-08-05 15:59:14 +01:00
ad7606_spi.c iio: adc: ad7606: Add support for AD7606B ADC 2019-08-25 16:11:00 +01:00
ad7606.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
ad7606.h iio: adc: ad7606: Add support for AD7606B ADC 2019-08-25 16:11:00 +01:00
ad7766.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
ad7768-1.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
ad7780.c Linux 5.8-rc6 2020-07-20 09:37:31 +02:00
ad7791.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
ad7793.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
ad7887.c iio: adc: ad7887: Demote seemingly unintentional kerneldoc header 2020-07-20 09:02:57 +01:00
ad7923.c iio: adc: ad7923: Demote obvious misuse of kerneldoc to standard comment blocks 2020-07-20 09:02:49 +01:00
ad7949.c iio: adc: ad7949: Fix misspelling issue 2020-09-21 18:41:36 +01:00
ad9467.c iio: adc: ad9467: return ENODEV vs EINVAL in ad9467_setup() 2020-09-16 19:15:54 +01:00
ad_sigma_delta.c iio: adc: ad_sigma_delta: Remove unused variable 'ret' 2020-07-20 09:02:46 +01:00
adi-axi-adc.c iio: adc: adi-axi-adc: Use kobj_to_dev() instead of container_of() 2020-09-03 19:40:47 +01:00
aspeed_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
at91_adc.c iio: adc: at91_adc: Fix 'bad line' warning 2020-07-20 09:03:22 +01:00
at91-sama5d2_adc.c iio: adc: at91-sama5d2_adc: Struct kerneldoc titles need to start with 'struct ' 2020-07-20 09:03:22 +01:00
axp20x_adc.c iio:adc:axp20x: Convert from OF to generic fw / device properties 2020-09-03 19:40:46 +01:00
axp288_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
bcm_iproc_adc.c iio:adc:bcm_iproc: Drop of_match_ptr protection and switch to mod_devicetable.h 2020-09-03 19:40:45 +01:00
berlin2-adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
cc10001_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
cpcap-adc.c iio: adc: cpcap-adc: Demote seemingly unintentional kerneldoc header 2020-07-20 09:03:23 +01:00
da9150-gpadc.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
dln2-adc.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
envelope-detector.c iio: adc: envelope-detector: Simplify with dev_err_probe() 2020-09-03 19:40:49 +01:00
ep93xx_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
exynos_adc.c iio: adc: exynos_adc: Replace indio_dev->mlock with own device lock 2020-09-21 20:01:50 +01:00
fsl-imx25-gcq.c iio: adc: fsl-imx25-gcq: Replace indio_dev->mlock with own device lock 2020-09-21 18:41:35 +01:00
hi8435.c iio:adc:hi8435: Drop of_match_ptr protection. 2020-07-07 20:24:08 +01:00
hx711.c iio: remove left-over parent assignments 2020-06-14 11:50:04 +01:00
imx7d_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ina2xx-adc.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
ingenic-adc.c Merge branch 'ib-5.8-jz47xx-ts' into HEAD 2020-07-22 14:36:31 +01:00
intel_mrfld_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
Kconfig iio: adc: rockchip_saradc: Allow compile-testing with !ARM 2020-09-06 16:13:40 +01:00
lp8788_adc.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
lpc18xx_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
lpc32xx_adc.c iio:adc:lpc32xx: Drop of_match_ptr protection 2020-07-07 20:24:08 +01:00
ltc2471.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ltc2485.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ltc2496.c iio:adc:ltc2496: Drop of_match_ptr and use mod_devicetable.h 2020-07-07 20:24:08 +01:00
ltc2497-core.c iio: adc: ltc2497: Simplify with dev_err_probe() 2020-09-03 19:40:49 +01:00
ltc2497.c iio:adc:ltc2497 drop of_match_ptr protection 2020-07-07 20:24:09 +01:00
ltc2497.h iio: adc: ltc2497: split protocol independent part in a separate module 2019-12-15 12:15:19 +00:00
Makefile Staging/IIO driver patches for 5.8-rc1 2020-06-07 10:45:08 -07:00
max1027.c iio:adc:max1027: drop of_match_ptr and CONFIG_OF protections 2020-07-07 20:24:08 +01:00
max1118.c iio:adc:max1118: Drop CONFIG_OF / of_match_ptr protections 2020-07-07 20:24:09 +01:00
max1241.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
max1363.c iio: adc: max1363: Fix kerneldoc attribute formatting for 'lock' 2020-07-20 09:03:27 +01:00
max9611.c iio: adc: max9611: Demote obvious misuse of kerneldoc to standard comment blocks 2020-07-20 09:03:27 +01:00
max11100.c iio:adc:max11100: Drop of_match_ptr protection / add mod_devicetable.h include 2020-07-07 20:24:09 +01:00
mcp320x.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
mcp3422.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
mcp3911.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
men_z188_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
meson_saradc.c iio: adc: meson-saradc: Make the of_device_id array style consistent 2020-09-16 19:17:24 +01:00
mp2629_adc.c iio: adc: mp2629: Add support for mp2629 ADC driver 2020-05-26 10:41:47 +01:00
mt6577_auxadc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
mxs-lradc-adc.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
nau7802.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
npcm_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
palmas_gpadc.c iio: adc: palmas_gpadc: use module_platform_driver to simplify the code 2020-09-16 19:09:51 +01:00
qcom-pm8xxx-xoadc.c iio: adc: qcom-pm8xxx-xoadc: Demote standard comment block and supply missing description 2020-07-20 09:03:31 +01:00
qcom-spmi-adc5.c iio: adc: Combine read functions for PMIC5 and PMIC7 2020-06-27 14:10:52 +01:00
qcom-spmi-iadc.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
qcom-spmi-vadc.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
qcom-vadc-common.c iio: adc: Add support for PMIC7 ADC 2020-06-14 11:49:21 +01:00
qcom-vadc-common.h iio: adc: Add support for PMIC7 ADC 2020-06-14 11:49:21 +01:00
rcar-gyroadc.c iio: adc: rcar-gyroadc: Simplify with dev_err_probe() 2020-09-03 19:40:49 +01:00
rn5t618-adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
rockchip_saradc.c iio: adc: rockchip_saradc: Demote seemingly unintentional kerneldoc header 2020-07-20 09:03:35 +01:00
sc27xx_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
sd_adc_modulator.c iio:adc:sd_adc_modulator: Drop of_match_ptr and tweak includes 2020-07-07 20:24:09 +01:00
spear_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
stm32-adc-core.c iio: adc: stm32: Fix missing return in booster error path 2020-09-13 10:43:55 +01:00
stm32-adc-core.h iio: adc: stm32-adc: Add check on overrun interrupt 2019-12-15 11:42:17 +00:00
stm32-adc.c iio: adc: stm32: Simplify with dev_err_probe() 2020-09-03 19:40:50 +01:00
stm32-dfsdm-adc.c iio: adc: stm32: Simplify with dev_err_probe() 2020-09-03 19:40:50 +01:00
stm32-dfsdm-core.c iio: adc: stm32: Simplify with dev_err_probe() 2020-09-03 19:40:50 +01:00
stm32-dfsdm.h iio: adc: stm32-dfsdm: add fast mode support 2019-06-22 10:29:19 +01:00
stmpe-adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
stx104.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
sun4i-gpadc-iio.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
ti_am335x_adc.c iio: adc: ti_am335x_adc: Remove a couple of unused 'read' variables 2020-07-20 09:03:11 +01:00
ti-adc081c.c iio:adc:ti-adc081c: Drop ACPI ids that seem very unlikely to be official. 2020-09-03 19:40:45 +01:00
ti-adc084s021.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
ti-adc108s102.c iio:adc:ti-adc108s102: Drop CONFIG_OF and of_match_ptr protections 2020-09-03 19:40:45 +01:00
ti-adc128s052.c iio:adc:ti-adc128s052: drop of_match_ptr protection 2020-09-03 19:40:45 +01:00
ti-adc161s626.c iio:adc:ti-adc161s626: Drop of_match_ptr protection. 2020-07-07 20:24:10 +01:00
ti-adc0832.c iio:adc:ti-adc0832 Fix alignment issue with timestamp 2020-09-21 20:01:51 +01:00
ti-adc12138.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
ti-ads124s08.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
ti-ads1015.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
ti-ads7950.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
ti-ads8344.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
ti-ads8688.c iio: Remove superfluous of_node assignments 2020-06-14 14:20:08 +01:00
ti-tlc4541.c Replace HTTP links with HTTPS ones: drivers/iio 2020-07-13 15:05:59 +01:00
twl4030-madc.c iio: adc: twl4030-madc: Fix misnamed struct attribute 2020-07-20 09:03:14 +01:00
twl6030-gpadc.c iio: adc: twl6030-gpadc: Fix some misdocumentation and formatting issues 2020-07-20 09:03:15 +01:00
vf610_adc.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
viperboard_adc.c iio: remove explicit IIO device parent assignment 2020-06-14 11:49:59 +01:00
xilinx-xadc-core.c iio: Move attach/detach of the poll func to the core 2020-06-20 17:34:44 +01:00
xilinx-xadc-events.c iio: xilinx-xadc: Fix typo in author's name 2020-03-21 10:25:35 +00:00
xilinx-xadc.h iio: xilinx-xadc: Fix typo in author's name 2020-03-21 10:25:35 +00:00