]> Git Repo - J-linux.git/commitdiff
Input: atmel_mxt_ts - don't try to free unallocated kernel memory
authorSanjeev Chugh <[email protected]>
Sat, 29 Dec 2018 01:04:31 +0000 (17:04 -0800)
committerDmitry Torokhov <[email protected]>
Sat, 29 Dec 2018 01:07:05 +0000 (17:07 -0800)
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 <[email protected]>
Fixes: a4891f105837 ("Input: atmel_mxt_ts - zero terminate config firmware file")
Cc: [email protected]
Signed-off-by: Dmitry Torokhov <[email protected]>
drivers/input/touchscreen/atmel_mxt_ts.c

index d3aacd534e9ca7fbf4e94504447e3c2a0e14170f..5c63d25ce84ebee9a6296de142c8cd6115a79701 100644 (file)
@@ -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;
 }
 
This page took 0.052204 seconds and 4 git commands to generate.