patch "iio: accel: bma400: Fix memory leak in bma400_get_steps_reg()" added to char-misc-next
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: accel: bma400: Fix memory leak in bma400_get_steps_reg()
to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-next branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will also be merged in the next major kernel release during the merge window.
If you have any questions about this process, please let me know.
From 20690cd50e68c0313472c7539460168b8ea6444d Mon Sep 17 00:00:00 2001
From: Dong Chenchen <[email protected]>
Date: Thu, 10 Nov 2022 09:07:26 +0800
Subject: iio: accel: bma400: Fix memory leak in bma400_get_steps_reg()
When regmap_bulk_read() fails, it does not free steps_raw, which will cause a memory leak issue, this patch fixes it.
--- drivers/iio/accel/bma400_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iio/accel/bma400_core.c +3 -1
@@ -805,8 +805,10 @@ static int bma400_get_steps_reg(struct bma400_data *data, int *val) ret =regmap_bulk_read (data->regmap,BMA400_STEP_CNT0_REG , steps_raw,BMA400_STEP_RAW_LEN ); -if (ret) +if (ret) { +kfree (steps_raw);return ret; + } *val =get_unaligned_le24 (steps_raw);kfree (steps_raw);return IIO_VAL_INT ;
Signature · 1 line
2.38.1