aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarun Prakash <varun@chelsio.com>2017-05-17 11:00:43 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2017-05-18 21:37:27 -0400
commita351e40b6de550049423a26f7ded7b639e363d89 (patch)
treeb15bb3bc32b9721c0425115b5166ae3d7fc1ccab
parent463f620b1256e0488d932088e04a372817e8c42e (diff)
scsi: csiostor: fix use after free in csio_hw_use_fwconfig()
mbp pointer is passed to csio_hw_validate_caps() so call mempool_free() after calling csio_hw_validate_caps(). Signed-off-by: Varun Prakash <varun@chelsio.com> Fixes: 541c571fa2fd ("csiostor:Use firmware version from cxgb4/t4fw_version.h") Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/csiostor/csio_hw.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/csiostor/csio_hw.c b/drivers/scsi/csiostor/csio_hw.c
index 622bdabc8894..dab195f04da7 100644
--- a/drivers/scsi/csiostor/csio_hw.c
+++ b/drivers/scsi/csiostor/csio_hw.c
@@ -1769,7 +1769,6 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param)
1769 goto bye; 1769 goto bye;
1770 } 1770 }
1771 1771
1772 mempool_free(mbp, hw->mb_mempool);
1773 if (finicsum != cfcsum) { 1772 if (finicsum != cfcsum) {
1774 csio_warn(hw, 1773 csio_warn(hw,
1775 "Config File checksum mismatch: csum=%#x, computed=%#x\n", 1774 "Config File checksum mismatch: csum=%#x, computed=%#x\n",
@@ -1780,6 +1779,10 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param)
1780 rv = csio_hw_validate_caps(hw, mbp); 1779 rv = csio_hw_validate_caps(hw, mbp);
1781 if (rv != 0) 1780 if (rv != 0)
1782 goto bye; 1781 goto bye;
1782
1783 mempool_free(mbp, hw->mb_mempool);
1784 mbp = NULL;
1785
1783 /* 1786 /*
1784 * Note that we're operating with parameters 1787 * Note that we're operating with parameters
1785 * not supplied by the driver, rather than from hard-wired 1788 * not supplied by the driver, rather than from hard-wired