mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
initialize_controller() records SCSI_DH_RES_TEMP_UNAVAIL when
get_controller() fails, but then overwrites it with SCSI_DH_OK
unconditionally. It therefore reports success with h->ctlr == NULL and
rdac_bus_attach() continues with check_ownership(), which dereferences
h->ctlr:
BUG: kernel NULL pointer dereference, address: 0000000000000000
...
check_ownership
rdac_bus_attach
get_controller() only fails when its GFP_ATOMIC allocation fails, so the
crash happens exactly when memory is already scarce.
Only report success after the controller was found and the device was added
to its list.
Fixes: 3278255741 ("scsi_dh_rdac: switch to scsi_execute_req_flags()")
Signed-off-by: Shao Mingyin <[email protected]>
Cc: [email protected]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Martin K. Petersen (Oracle) <[email protected]>