* [PATCH] input: atmel_mxt_ts: fix double free
@ 2020-08-03 13:48 trix
0 siblings, 0 replies; only message in thread
From: trix @ 2020-08-03 13:48 UTC (permalink / raw
To: nick, dmitry.torokhov, ezequiel, bleung
Cc: linux-input, linux-kernel, Tom Rix
From: Tom Rix <trix@redhat.com>
Clang static analysis reports this error
atmel_mxt_ts.c:1850:2: warning: Attempt to free released memory
kfree(id_buf);
^~~~~~~~~~~~~
The problem is with this code block
data->raw_info_block = id_buf;
...
error = mxt_parse_object_table(data, id_buf + MXT_OBJECT_START);
if (error) {
dev_err(&client->dev, "Error %d parsing object table\n", error);
mxt_free_object_table(data);
goto err_free_mem;
}
mxt_free_object_table() frees id_buf
kfree(data->raw_info_block);
So skip over the second free
Fixes: 068bdb67ef74 ("Input: atmel_mxt_ts - fix the firmware update")
Signed-off-by: Tom Rix <trix@redhat.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 6b71b0aff115..1cc0f492f4f4 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1839,7 +1839,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;
+ goto err_free_mem1;
}
data->object_table = (struct mxt_object *)(id_buf + MXT_OBJECT_START);
@@ -1848,6 +1848,7 @@ static int mxt_read_info_block(struct mxt_data *data)
err_free_mem:
kfree(id_buf);
+err_free_mem1:
return error;
}
--
2.18.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-03 13:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-08-03 13:48 [PATCH] input: atmel_mxt_ts: fix double free trix
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.