scsi: qla2xxx: Fix crashes in qla2x00_probe_one on probe failure
authorBill Kuzeja <William.Kuzeja@stratus.com>
Mon, 5 Mar 2018 05:02:55 +0000 (00:02 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Mar 2018 11:06:45 +0000 (12:06 +0100)
commitc209d68794e632241875c14a0731ab211b31cfcb
tree5eabf161e960b809d089283053d94fad9ed2e559
parent91cb90636e038c8403ac581f3cc285efd1ba5ec5
scsi: qla2xxx: Fix crashes in qla2x00_probe_one on probe failure

commit 6a2cf8d3663e13e19af636c2a8d92e766261dc45 upstream.

Because of the shifting around of code in qla2x00_probe_one recently,
failures during adapter initialization can lead to problems, i.e. NULL
pointer crashes and doubly freed data structures which cause eventual
panics.

This V2 version makes the relevant memory free routines idempotent, so
repeat calls won't cause any harm. I also removed the problematic
probe_init_failed exit point as it is not needed.

Fixes: d64d6c5671db ("scsi: qla2xxx: Fix NULL pointer crash due to probe failure")
Signed-off-by: Bill Kuzeja <william.kuzeja@stratus.com>
Acked-by: Himanshu Madhani <himanshu.madhani@cavium.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/scsi/qla2xxx/qla_os.c