All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mpt3sas:Fix kernel panic during drive powercycle test
@ 2021-11-17 10:49 Sreekanth Reddy
  2021-11-19  4:16 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Sreekanth Reddy @ 2021-11-17 10:49 UTC (permalink / raw)
  To: linux-scsi, martin.petersen; +Cc: Sreekanth Reddy

[-- Attachment #1: Type: text/plain, Size: 1146 bytes --]

While looping over shost's sdev list it is possible that one
of the drive is getting removed and it's sas_target object is
freed but it's sdev object is still intact with the sdev list.
So, kernel panic occurred while driver trying to access the sas_address
field of sas_target object without checking the sas_target object
for NULL pointer.

Fixes: f92363d12359("mpt3sas: add new driver supporting 12GB SAS")
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index cee7170beae8..bb0036b41825 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3869,7 +3869,7 @@ _scsih_ublock_io_device(struct MPT3SAS_ADAPTER *ioc,
 
 	shost_for_each_device(sdev, ioc->shost) {
 		sas_device_priv_data = sdev->hostdata;
-		if (!sas_device_priv_data)
+		if (!sas_device_priv_data || !sas_device_priv_data->sas_target)
 			continue;
 		if (sas_device_priv_data->sas_target->sas_address
 		    != sas_address)
-- 
2.27.0


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4218 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mpt3sas:Fix kernel panic during drive powercycle test
  2021-11-17 10:49 [PATCH] mpt3sas:Fix kernel panic during drive powercycle test Sreekanth Reddy
@ 2021-11-19  4:16 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2021-11-19  4:16 UTC (permalink / raw)
  To: linux-scsi, Sreekanth Reddy; +Cc: Martin K . Petersen

On Wed, 17 Nov 2021 16:19:09 +0530, Sreekanth Reddy wrote:

> While looping over shost's sdev list it is possible that one
> of the drive is getting removed and it's sas_target object is
> freed but it's sdev object is still intact with the sdev list.
> So, kernel panic occurred while driver trying to access the sas_address
> field of sas_target object without checking the sas_target object
> for NULL pointer.
> 
> [...]

Applied to 5.16/scsi-fixes, thanks!

[1/1] mpt3sas:Fix kernel panic during drive powercycle test
      https://git.kernel.org/mkp/scsi/c/0ee4ba13e09c

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-19  4:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-17 10:49 [PATCH] mpt3sas:Fix kernel panic during drive powercycle test Sreekanth Reddy
2021-11-19  4:16 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.