Skip to contentSkip to conversation

Input: atmel_mxt_ts - fix double free in mxt_read_info_block

PATCH Applied José Expósito 2 participants 2 messages Dec 12, 2021 – Dec 13, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: atmel_mxt_ts - fix double free in mxt_read_info_block

The "id_buf" buffer is stored in "data->raw_info_block" and freed by "mxt_free_object_table" in case of error.

Return instead of jumping to avoid a double free.

Addresses-Coverity-ID: 1474582 ("Double free")

---
 drivers/input/touchscreen/atmel_mxt_ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/atmel_mxt_ts.c +1 -1
index 05de92c0293b..eb66cd2689b7 100644
@@ -1882,7 +1882,7 @@ static int mxt_read_info_block(struct mxt_data *data)
 	if (error) {
 		dev_err(&client->dev, "Error %d parsing object table\n", error);
 		mxt_free_object_table(data);
-		goto err_free_mem;
+		return error;
 	}
 
 	data->object_table = (struct mxt_object *)(id_buf + MXT_OBJECT_START);
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw
Quoted 7 lines · José Expósito

The "id_buf" buffer is stored in "data->raw_info_block" and freed by "mxt_free_object_table" in case of error.

Return instead of jumping to avoid a double free.

Addresses-Coverity-ID: 1474582 ("Double free")

Applied, thank you.

Signature · 1 line
Dmitry