Skip to content

Commit

Permalink
Input: atmel_mxt_ts - don't try to free unallocated kernel memory
Browse files Browse the repository at this point in the history
If the user attempts to update Atmel device with an invalid configuration
cfg file, error handling code is trying to free cfg file memory which is
not allocated yet hence results into kernel crash.

This patch fixes the order of memory free operations.

Signed-off-by: Sanjeev Chugh <sanjeev_chugh@mentor.com>
Fixes: a4891f1 ("Input: atmel_mxt_ts - zero terminate config firmware file")
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
  • Loading branch information
Sanjeev Chugh authored and Dmitry Torokhov committed Dec 29, 2018
1 parent d52266f commit 1e3c336
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1585,10 +1585,10 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *fw)
/* T7 config may have changed */
mxt_init_t7_power_cfg(data);

release_raw:
kfree(cfg.raw);
release_mem:
kfree(cfg.mem);
release_raw:
kfree(cfg.raw);
return ret;
}

Expand Down

0 comments on commit 1e3c336

Please sign in to comment.