scsi: csiostor: fix use after free in csio_hw_use_fwconfig()
PATCH 1/1 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 <[email protected]>
--- drivers/scsi/csiostor/csio_hw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/csiostor/csio_hw.c +4 -1
@@ -1780,7 +1780,6 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param) goto bye; } -mempool_free (mbp, hw->mb_mempool);if (finicsum != cfcsum) { csio_warn(hw, "Config File checksum mismatch: csum=%#x, computed=%#x\n",
@@ -1791,6 +1790,10 @@ csio_hw_use_fwconfig(struct csio_hw *hw, int reset, u32 *fw_cfg_param) rv =csio_hw_validate_caps (hw, mbp);if (rv !=0 ) goto bye; + +mempool_free (mbp, hw->mb_mempool); + mbp =NULL ; +/* * Note that we're operating with parameters * not supplied by the driver, rather than from hard-wired
Signature · 1 line
2.0.2
Quoted 5 lines · Varun Prakash
mbp pointer is passed to
csio_hw_validate_caps()so callmempool_free()after callingcsio_hw_validate_caps().Signed-off-by Varun Prakash <[email protected]>---
Fixes 541c571fa2fd ("csiostor:Use firmware version from
cxgb4/t4fw_version.h")
Reviewed-by Johannes Thumshirn <[email protected]>
Thanks,
Johannes
Signature · 6 lines
Johannes Thumshirn Storage [email protected] +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Martin K. Petersen
AppliedVarun,
Quoted 2 lines
mbp pointer is passed to
csio_hw_validate_caps()so callmempool_free()after callingcsio_hw_validate_caps().
Applied to 4.12/scsi-fixes. Thank you!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering