Ok, coming back to this path as it's the start of somethign building
up over various patches:

> +     pg = kzalloc(sizeof(struct alua_port_group), GFP_KERNEL);
> +     if (!pg) {
> +             sdev_printk(KERN_WARNING, sdev,
> +                         "%s: kzalloc port group failed\n",
> +                         ALUA_DH_NAME);
> +             /* Temporary failure, bypass */
> +             return SCSI_DH_DEV_TEMP_BUSY;
> +     }
> +     pg->group_id = group_id;
> +     pg->buff = pg->inq;
> +     pg->bufflen = ALUA_INQUIRY_SIZE;
> +     pg->tpgs = h->tpgs;
> +     pg->state = TPGS_STATE_OPTIMIZED;
> +     kref_init(&pg->kref);
> +     spin_lock(&port_group_lock);
> +     list_add(&pg->node, &port_group_list);
> +     h->pg = pg;
> +     spin_unlock(&port_group_lock);
> +
> +     return SCSI_DH_OK;

All this code isn't really checking the VPD anymore.  Please keep
the existing alua_check_vpd as a low-level helper, and move this
new functionality into a separate alua_find_get_pg function that
calls the original alua_check_vpd.  Also please return the
pg from it so that we c

> @@ -596,13 +643,12 @@ static int alua_initialize(struct scsi_device *sdev, 
> struct alua_dh_data *h)
>               goto out;
>  
>       err = alua_check_vpd(sdev, h);
> -     if (err != SCSI_DH_OK)
> -             goto out;
> -
> -     err = alua_rtpg(sdev, h, 0);
> -     if (err != SCSI_DH_OK)
> +     if (err != SCSI_DH_OK || !h->pg)
>               goto out;

How could we end up here without h->pg? Either way that should
move into a conditional together with the kref_get which should
become the not_zero variant if it is kept.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to