Fixup LLDDs to check for valid hostdata pointer
Subsystems (7)
PATCH 5/9 Fixup LLDDs to check for valid hostdata pointer
slave_destory() is now called asynchronously, hence we have to check if the ->hostdata pointer is valid before accessing it. Fixup all LLDDs to verify the hostdata pointer.
Signed-off-by Hannes Reinecke <[email protected]>
--- drivers/message/fusion/mptscsih.c | 2 ++ drivers/s390/scsi/zfcp_scsi.c | 3 --- drivers/scsi/53c700.c | 6 ++++-- drivers/scsi/aic7xxx_old.c | 8 +++++--- drivers/scsi/esp_scsi.c | 6 ++++-- drivers/scsi/sym53c8xx_2/sym_glue.c | 2 ++ 6 files changed, 17 insertions(+), 10 deletions(-)
drivers/message/fusion/mptscsih.c +2 -0
@@ -2314,6 +2314,8 @@ mptscsih_slave_destroy(struct scsi_devic starget =scsi_target (sdev); vtarget = starget->hostdata; vdevice = sdev->hostdata; +if (!vdevice) +return ;mptscsih_search_running_cmds (hd, vdevice); vtarget->num_luns--;
drivers/s390/scsi/zfcp_scsi.c +0 -3
@@ -189,9 +189,6 @@ static void zfcp_scsi_slave_destroy(stru unit->device =NULL ;zfcp_erp_unit_failed (unit);zfcp_unit_put (unit); - }else { -ZFCP_LOG_NORMAL ("bug: no unit associated with SCSI device at " -"address %p\n" , sdpnt); } }
drivers/scsi/53c700.c +4 -2
@@ -2103,8 +2103,10 @@ NCR_700_slave_configure(struct scsi_devi STATIC voidNCR_700_slave_destroy (struct scsi_device *SDp) { -kfree (SDp->hostdata); - SDp->hostdata =NULL ; +if (SDp->hostdata) { +kfree (SDp->hostdata); + SDp->hostdata =NULL ; + } } static int
drivers/scsi/aic7xxx_old.c +5 -3
@@ -6733,9 +6733,11 @@ aic7xxx_slave_destroy(struct scsi_device {struct aic_dev_data *aic_dev = SDptr->hostdata; -list_del (&aic_dev->list); - SDptr->hostdata =NULL ; -kfree (aic_dev); +if (aic_dev) { +list_del (&aic_dev->list); + SDptr->hostdata =NULL ; +kfree (aic_dev); + }return ; }
drivers/scsi/esp_scsi.c +4 -2
@@ -2416,8 +2416,10 @@ static void esp_slave_destroy(struct scs {struct esp_lun_data *lp = dev->hostdata; -kfree (lp); - dev->hostdata =NULL ; +if (dev->hostdata) { +kfree (lp); + dev->hostdata =NULL ; + } }static int esp_eh_abort_handler (struct scsi_cmnd *cmd)
drivers/scsi/sym53c8xx_2/sym_glue.c +2 -0
@@ -983,6 +983,8 @@ static void sym53c8xx_slave_destroy(strustruct sym_hcb *np =sym_get_hcb (sdev->host);struct sym_lcb *lp =sym_lp (&np->target[sdev->id], sdev->lun); +if (!lp) +return ;if (lp->itlq_tbl)sym_mfree_dma (lp->itlq_tbl,SYM_CONF_MAX_TASK *4 ,"ITLQ_TBL" );kfree (lp->cb_tags);
Signature · 1 line
1.4.3.4
Quoted 4 lines · Hannes Reinecke
slave_destory()is now called asynchronously, hence we have to check if the ->hostdata pointer is valid before accessing it. Fixup all LLDDs to verify the hostdata pointer.
No way we're going to put this in. This just creates a complete mess in the drivers. Please rework your patch series to avoid this issue.