On 30/04/2020 14:18, Hannes Reinecke wrote:
Thanks for this.
Conversion of the SAS drivers hisi_sas, pm8001, and mv_sas are
compile tested only; I'd be grateful if someone could give
these patches a spin on that hardware, too.
So after some build fixups, I get this a NULL pointer deref:
[ 5.565899] sas_find_dev_by_rphy+0x3c/0x104
[ 5.570182] sas_target_alloc+0x18/0x84
[ 5.574029] scsi_alloc_target+0x20c/0x304
[ 5.578136] scsi_get_virtual_dev+0x44/0xec
[ 5.582331] sas_register_ha+0xd0/0x258
[ 5.586178] hisi_sas_probe+0x2ec/0x36c
[ 5.590024] hisi_sas_v2_probe+0x34/0x64
[ 5.593958] platform_drv_probe+0x4c/0xa0
[ 5.597978] really_probe+0xd8/0x334
[ 5.601561] driver_probe_device+0x58/0xe8
[ 5.605669] device_driver_attach+0x68/0x70
[ 5.609864] __driver_attach+0x9c/0xf8
[ 5.613622] bus_for_each_dev+0x50/0xa0
[ 5.617468] driver_attach+0x20/0x28
[ 5.621051] bus_add_driver+0x148/0x1fc
[ 5.624897] driver_register+0x6c/0x124
[ 5.628742] __platform_driver_register+0x48/0x50
[ 5.633463] hisi_sas_v2_driver_init+0x18/0x20
[ 5.637921] do_one_initcall+0x50/0x194
[ 5.641767] kernel_init_freeable+0x1e4/0x24c
And so we need this change:
commit 51f607bf91853026af102367d9e6666605cdec61 (HEAD)
Author: John Garry <john.garry@xxxxxxxxxx>
Date: Fri May 1 12:30:32 2020 +0100
scsi: libsas: Don't attempt to find scsi host rphy in target alloc
It doesn't have one.
Signed-off-by: John Garry <john.garry@xxxxxxxxxx>
diff --git a/drivers/scsi/libsas/sas_scsi_host.c
b/drivers/scsi/libsas/sas_scsi_host.c
index 585e0df5fce2..f1a823d51044 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -822,8 +825,15 @@ struct domain_device *sas_find_dev_by_rphy(struct
sas_rphy *rphy)
int sas_target_alloc(struct scsi_target *starget)
{
- struct sas_rphy *rphy = dev_to_rphy(starget->dev.parent);
- struct domain_device *found_dev = sas_find_dev_by_rphy(rphy);
+ struct device *parent = starget->dev.parent;
+ struct sas_rphy *rphy;
+ struct domain_device *found_dev;
+
+ if (scsi_is_host_device(parent))
+ return 0;
+
+ rphy = dev_to_rphy(parent);
+ found_dev = sas_find_dev_by_rphy(rphy);
Cheers,