On Thu, 2023-07-06 at 09:41 -0400, Laurence Oberman wrote: > On Wed, 2023-07-05 at 22:35 -0400, Martin K. Petersen wrote: > > > > Laurence, > > > > > In the current code, If a device does not have protection, qla2xx > > > will > > > land up defaulting to a BUG() and will panic the system when > > > sg_write_same is sent.This is because SCSI_PROT_NORMAL is matched > > > and > > > falls through to the BUG() call. The write_same command to a > > > device > > > without protection is not handled safely. > > > > I would like to understand why the driver PI code path was chosen > > for > > a > > SCSI_PROT_NORMAL cmnd. That doesn't seem right. > > > > > + case SCSI_PROT_NORMAL: > > > + total_bytes = data_bytes; > > > + break; > > > case SCSI_PROT_READ_INSERT: > > > case SCSI_PROT_WRITE_STRIP: > > > total_bytes = data_bytes; > > > > All this transfer size wrangling in the driver should be removed > > and > > replaced with a call to scsi_transfer_length() which takes the PI > > size > > into account. > > > Martin, good questions > > I am waiting on Marvell to decide what to do about all this. > > The patch was focused only on avoiding the nasty effect of what you > mention happens in that code path, causing customers to have system > panics. > > The patch is to avoid the panic at this point with minimal impact to > prior code functionality. > > Regards > Laurence > > > > > > Hello Nilesh and Marvell Any chance to get comments/eyes on this please. Given its causing system crashes we need to decide how best to deal with it. regards Laurence