]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC
authorzhili.liu <zhili.liu@ucas.com.cn>
Tue, 2 Jan 2024 01:07:11 +0000 (09:07 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 08:25:06 +0000 (09:25 +0100)
commit1d8c67e94e9e977603473a543d4f322cf2c4aa01
tree2c701aa3cde04ea64872edf9968d5ac767652d5c
parentf83ec2ee91d07d954e3a322f8dc84f85a2a357a5
iio: magnetometer: rm3100: add boundary check for the value read from RM3100_REG_TMRC

commit 792595bab4925aa06532a14dd256db523eb4fa5e upstream.

Recently, we encounter kernel crash in function rm3100_common_probe
caused by out of bound access of array rm3100_samp_rates (because of
underlying hardware failures). Add boundary check to prevent out of
bound access.

Fixes: 121354b2eceb ("iio: magnetometer: Add driver support for PNI RM3100")
Suggested-by: Zhouyi Zhou <zhouzhouyi@gmail.com>
Signed-off-by: zhili.liu <zhili.liu@ucas.com.cn>
Link: https://lore.kernel.org/r/1704157631-3814-1-git-send-email-zhouzhouyi@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/magnetometer/rm3100-core.c