提交 07f50997 编写于 作者: J James Smart 提交者: Martin K. Petersen

scsi: lpfc: Fix null ptr oops updating lpfc_devloss_tmo via sysfs attribute

If an admin updates lpfc's devloss_tmo sysfs attribute, the kernel will
oops.

Coding of a loop allowed a new value (rport) to be set/checked for null
followed by an older value (remoteport) checked for null to allow progress
where the new value, even though null, will be referenced.

Rework the logic to validate and prevent any reference to the null ptr.
Signed-off-by: NDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: NJames Smart <jsmart2021@gmail.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 6ede2ddd
......@@ -3682,8 +3682,8 @@ lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
if (rport)
remoteport = rport->remoteport;
spin_unlock(&vport->phba->hbalock);
if (remoteport)
nvme_fc_set_remoteport_devloss(rport->remoteport,
if (rport && remoteport)
nvme_fc_set_remoteport_devloss(remoteport,
vport->cfg_devloss_tmo);
#endif
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册