HID: intel-ish-hid: Fix a use after free in load_fw_from_host()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 26 Jun 2019 10:10:41 +0000 (13:10 +0300)
committerJiri Kosina <jkosina@suse.cz>
Wed, 26 Jun 2019 11:30:16 +0000 (13:30 +0200)
We have to print the filename first before we can kfree it.

Fixes: 91b228107da3 ("HID: intel-ish-hid: ISH firmware loader client driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/intel-ish-hid/ishtp-fw-loader.c

index 22ba2145703504ce1c34af1ef59ddf3eea6d12d7..aa2dbed30fc36aef68c81a7d16b355034f0a677d 100644 (file)
@@ -816,9 +816,9 @@ static int load_fw_from_host(struct ishtp_cl_data *client_data)
                goto end_err_fw_release;
 
        release_firmware(fw);
-       kfree(filename);
        dev_info(cl_data_to_dev(client_data), "ISH firmware %s loaded\n",
                 filename);
+       kfree(filename);
        return 0;
 
 end_err_fw_release: