> -----Original Message----- > From: Tomas Henzl [mailto:thenzl@xxxxxxxxxx] > Sent: Friday, June 4, 2021 11:56 PM > To: linux-scsi@xxxxxxxxxxxxxxx > Cc: kashyap.desai@xxxxxxxxxxxx; sathya.prakash@xxxxxxxxxxxx > Subject: [PATCH] mpi3mr: fix a double free > > Fix a double free, scsi_tgt_priv_data will be freed in mpi3mr_target_destroy. > I've also removed a second init of starget->hostdata with the same value. > Tomas - Patch looks good. We can also include below changes on top of your current patch. --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -3293,10 +3293,6 @@ static int mpi3mr_target_alloc(struct scsi_target *starget) if (!scsi_tgt_priv_data) return -ENOMEM; - starget->hostdata = scsi_tgt_priv_data; - scsi_tgt_priv_data->starget = starget; - scsi_tgt_priv_data->dev_handle = MPI3MR_INVALID_DEV_HANDLE; - spin_lock_irqsave(&mrioc->tgtdev_lock, flags); tgt_dev = __mpi3mr_get_tgtdev_by_perst_id(mrioc, starget->id); if (tgt_dev && !tgt_dev->is_hidden) {
Attachment:
smime.p7s
Description: S/MIME Cryptographic Signature