All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: atmel_mxt_ts - fix double free in mxt_read_info_block
@ 2021-12-12 19:42 José Expósito
  2021-12-13  5:02 ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: José Expósito @ 2021-12-12 19:42 UTC (permalink / raw)
  To: nick
  Cc: dmitry.torokhov, rydberg, linux-input, linux-kernel,
	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")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 05de92c0293b..eb66cd2689b7 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: atmel_mxt_ts - fix double free in mxt_read_info_block
  2021-12-12 19:42 [PATCH] Input: atmel_mxt_ts - fix double free in mxt_read_info_block José Expósito
@ 2021-12-13  5:02 ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2021-12-13  5:02 UTC (permalink / raw)
  To: José Expósito; +Cc: nick, rydberg, linux-input, linux-kernel

On Sun, Dec 12, 2021 at 08:42:57PM +0100, José Expósito wrote:
> 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")
> Signed-off-by: José Expósito <jose.exposito89@gmail.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-13  5:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-12 19:42 [PATCH] Input: atmel_mxt_ts - fix double free in mxt_read_info_block José Expósito
2021-12-13  5:02 ` Dmitry Torokhov

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.