serial: icom: dereference after free in load_code()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 Nov 2013 09:53:48 +0000 (12:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Dec 2013 01:16:05 +0000 (17:16 -0800)
We use "fw" in the next line after we release it.  I've shifted the call
to release_firmware() down a couple lines to fix this.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/icom.c

index d98e4334897040cd7e6a482fee5a7a913338c4ec..67423805e6d9b0ed761c26958e7cf2df9a31e8f0 100644 (file)
@@ -455,11 +455,11 @@ static void load_code(struct icom_port *icom_port)
        for (index = 0; index < fw->size; index++)
                new_page[index] = fw->data[index];
 
-       release_firmware(fw);
-
        writeb((char) ((fw->size + 16)/16), &icom_port->dram->mac_length);
        writel(temp_pci, &icom_port->dram->mac_load_addr);
 
+       release_firmware(fw);
+
        /*Setting the syncReg to 0x80 causes adapter to start downloading
           the personality code into adapter instruction RAM.
           Once code is loaded, it will begin executing and, based on
This page took 0.028445 seconds and 5 git commands to generate.