Skip to content

Commit a351e40

Browse files
Varun Prakashmartinkpetersen
authored andcommitted
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: 541c571 ("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>
1 parent 463f620 commit a351e40

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/scsi/csiostor/csio_hw.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1769,7 +1769,6 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param)
17691769
goto bye;
17701770
}
17711771

1772-
mempool_free(mbp, hw->mb_mempool);
17731772
if (finicsum != cfcsum) {
17741773
csio_warn(hw,
17751774
"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)
17801779
rv = csio_hw_validate_caps(hw, mbp);
17811780
if (rv != 0)
17821781
goto bye;
1782+
1783+
mempool_free(mbp, hw->mb_mempool);
1784+
mbp = NULL;
1785+
17831786
/*
17841787
* Note that we're operating with parameters
17851788
* not supplied by the driver, rather than from hard-wired

0 commit comments

Comments
 (0)