aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-08 04:53:48 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-08 20:16:05 -0500
commitd6a62b3b7eb1a000718f8ecac0c31eaa1e1f1187 (patch)
treee29d5ea8d446e97034143ae4f8fcd1a93eb829d1
parent50a22ba07453e242668cfc4f312602cc8165cde5 (diff)
serial: icom: dereference after free in load_code()
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>
-rw-r--r--drivers/tty/serial/icom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c
index d98e43348970..67423805e6d9 100644
--- a/drivers/tty/serial/icom.c
+++ b/drivers/tty/serial/icom.c
@@ -455,11 +455,11 @@ static void load_code(struct icom_port *icom_port)
455 for (index = 0; index < fw->size; index++) 455 for (index = 0; index < fw->size; index++)
456 new_page[index] = fw->data[index]; 456 new_page[index] = fw->data[index];
457 457
458 release_firmware(fw);
459
460 writeb((char) ((fw->size + 16)/16), &icom_port->dram->mac_length); 458 writeb((char) ((fw->size + 16)/16), &icom_port->dram->mac_length);
461 writel(temp_pci, &icom_port->dram->mac_load_addr); 459 writel(temp_pci, &icom_port->dram->mac_load_addr);
462 460
461 release_firmware(fw);
462
463 /*Setting the syncReg to 0x80 causes adapter to start downloading 463 /*Setting the syncReg to 0x80 causes adapter to start downloading
464 the personality code into adapter instruction RAM. 464 the personality code into adapter instruction RAM.
465 Once code is loaded, it will begin executing and, based on 465 Once code is loaded, it will begin executing and, based on