Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15052c9e authored by Kashyap, Desai's avatar Kashyap, Desai Committed by James Bottomley
Browse files

[SCSI] mpt2sas: Introduced check for enclosure_handle to avoid crash



Kernel panic is seen because of enclosure_handle received from FW is zero.
Check is introduced before calling mpt2sas_config_get_enclosure_pg0.

Signed-off-by: default avatarKashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 3493e84d
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -3663,12 +3663,11 @@ _scsih_add_device(struct MPT2SAS_ADAPTER *ioc, u16 handle, u8 phy_num, u8 is_pd)
	sas_device->hidden_raid_component = is_pd;
	sas_device->hidden_raid_component = is_pd;


	/* get enclosure_logical_id */
	/* get enclosure_logical_id */
	if (!(mpt2sas_config_get_enclosure_pg0(ioc, &mpi_reply, &enclosure_pg0,
	if (sas_device->enclosure_handle && !(mpt2sas_config_get_enclosure_pg0(
	   MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE,
	   ioc, &mpi_reply, &enclosure_pg0, MPI2_SAS_ENCLOS_PGAD_FORM_HANDLE,
	   sas_device->enclosure_handle))) {
	   sas_device->enclosure_handle)))
		sas_device->enclosure_logical_id =
		sas_device->enclosure_logical_id =
		    le64_to_cpu(enclosure_pg0.EnclosureLogicalID);
		    le64_to_cpu(enclosure_pg0.EnclosureLogicalID);
	}


	/* get device name */
	/* get device name */
	sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName);
	sas_device->device_name = le64_to_cpu(sas_device_pg0.DeviceName);