]> www.infradead.org Git - users/dwmw2/linux.git/commit
scsi: qedf: Fix crash when MFW calls for protocol stats while function is still probing
authorChad Dupuis <cdupuis@marvell.com>
Thu, 16 Apr 2020 08:43:13 +0000 (01:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:34 +0000 (17:48 +0200)
commit0cc5b8ed5acd8372b3d79fbca4ab33c97b8d7089
tree61c1745745f9eaadf21d643ed5096f2deff7ec93
parent888f9d73bfde50c370b32664f3e49635e167b88d
scsi: qedf: Fix crash when MFW calls for protocol stats while function is still probing

[ Upstream commit ad40f5256095c68dc17c991eb976261d5ea2daaa ]

The MFW may make a call to qed and then to qedf for protocol statistics
while the function is still probing.  If this happens it's possible that
some members of the struct qedf_ctx may not be fully initialized which can
result in a NULL pointer dereference or general protection fault.

To prevent this, add a new flag call QEDF_PROBING and set it when the
__qedf_probe() function is active. Then in the qedf_get_protocol_tlv_data()
function we can check if the function is still probing and return
immediantely before any uninitialized structures can be touched.

Link: https://lore.kernel.org/r/20200416084314.18851-9-skashyap@marvell.com
Signed-off-by: Chad Dupuis <cdupuis@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/qedf/qedf.h
drivers/scsi/qedf/qedf_main.c