summaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/atmel_mxt_ts.c
diff options
context:
space:
mode:
authorSanjeev Chugh <sanjeev_chugh@mentor.com>2018-12-29 02:04:31 +0100
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2018-12-29 02:07:05 +0100
commit1e3c336ad8f40f88a8961c434640920fe35cc08b (patch)
treecfeb28c9b477656bc442ece9999b337f03502426 /drivers/input/touchscreen/atmel_mxt_ts.c
parentInput: drv2667 - fix indentation issues (diff)
downloadlinux-1e3c336ad8f40f88a8961c434640920fe35cc08b.tar.xz
linux-1e3c336ad8f40f88a8961c434640920fe35cc08b.zip
Input: atmel_mxt_ts - don't try to free unallocated kernel memory
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: a4891f105837 ("Input: atmel_mxt_ts - zero terminate config firmware file") Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/touchscreen/atmel_mxt_ts.c')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index d3aacd534e9c..5c63d25ce84e 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -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;
}