]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: adc: ad7768-1: Fix ERR_PTR dereference in ad7768_fill_scale_tbl
authorEthan Tidmore <ethantidmore06@gmail.com>
Sat, 14 Feb 2026 18:46:37 +0000 (12:46 -0600)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 23 Feb 2026 08:24:38 +0000 (08:24 +0000)
commitdd6183e42719cc54057579b8e6be5348cecfeda7
tree0d576817331304c32e7c66012c6760c85e646bcd
parentc3914ce1963c4db25e186112c90fa5d2361e9e0a
iio: adc: ad7768-1: Fix ERR_PTR dereference in ad7768_fill_scale_tbl

The function iio_get_current_scan_type() can return an error pointer,
the return value scan_type is not checked for this and immediately
dereferenced which can cause a kernel panic.

Add check for IS_ERR() and propagate the error back.

Fixes: ff085189cb17 ("iio: adc: ad7768-1: add support for ADAQ776x-1 ADC Family")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Closes: https://lore.kernel.org/r/202602051234.5gArzLyZ-lkp@intel.com/
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7768-1.c