All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic
@ 2021-05-11  3:04 Matt Wang
  2021-05-15  3:13 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Wang @ 2021-05-11  3:04 UTC (permalink / raw)
  To: martin.petersen, linux-scsi

Commit 391e2f25601e ("BusLogic: Port driver to 64-bit") in Buslogic
driver introduced a serious issue for 64-bit systems. With this
commit, 64-bit kernel will enumerate 8*15 non-existing disks.  This
is caused by the broken CCB structure. The change from u32 data to
void *data increased CCB length on 64-bit system, which introduced
an extra 4 byte offset of the CDB. This leads to incorrect response
to INQUIRY commands during enumeration.

Fix disk enumeration failure by reverting the portion of commit 
391e2f25601e which switched the data pointer from u32 to void

Signed-off-by: Matt Wang <wwentao@vmware.com>
Acked-by: Khalid Aziz <khalid@gonehiking.org>
---
drivers/scsi/BusLogic.c | 6 +++---
drivers/scsi/BusLogic.h | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
index ccb061ab0a0a..7231de2767a9 100644
--- a/drivers/scsi/BusLogic.c
+++ b/drivers/scsi/BusLogic.c
@@ -3078,11 +3078,11 @@ static int blogic_qcmd_lck(struct scsi_cmnd *command,
		ccb->opcode = BLOGIC_INITIATOR_CCB_SG;
		ccb->datalen = count * sizeof(struct blogic_sg_seg);
		if (blogic_multimaster_type(adapter))
-			ccb->data = (void *)((unsigned int) ccb->dma_handle +
+			ccb->data = (unsigned int) ccb->dma_handle +
					((unsigned long) &ccb->sglist -
-					(unsigned long) ccb));
+					(unsigned long) ccb);
		else
-			ccb->data = ccb->sglist;
+			ccb->data = virt_to_32bit_virt(ccb->sglist);

		scsi_for_each_sg(command, sg, count, i) {
			ccb->sglist[i].segbytes = sg_dma_len(sg);
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h
index 6182cc8a0344..e081ad47d1cf 100644
--- a/drivers/scsi/BusLogic.h
+++ b/drivers/scsi/BusLogic.h
@@ -814,7 +814,7 @@ struct blogic_ccb {
	unsigned char cdblen;				/* Byte 2 */
	unsigned char sense_datalen;			/* Byte 3 */
	u32 datalen;					/* Bytes 4-7 */
-	void *data;					/* Bytes 8-11 */
+	u32 data;					/* Bytes 8-11 */
	unsigned char:8;				/* Byte 12 */
	unsigned char:8;				/* Byte 13 */
	enum blogic_adapter_status adapter_status;	/* Byte 14 */
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic
  2021-05-11  3:04 [PATCH v2] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Matt Wang
@ 2021-05-15  3:13 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2021-05-15  3:13 UTC (permalink / raw)
  To: linux-scsi, Matt Wang; +Cc: Martin K . Petersen

On Tue, 11 May 2021 03:04:37 +0000, Matt Wang wrote:

> Commit 391e2f25601e ("BusLogic: Port driver to 64-bit") in Buslogic
> driver introduced a serious issue for 64-bit systems. With this
> commit, 64-bit kernel will enumerate 8*15 non-existing disks.  This
> is caused by the broken CCB structure. The change from u32 data to
> void *data increased CCB length on 64-bit system, which introduced
> an extra 4 byte offset of the CDB. This leads to incorrect response
> to INQUIRY commands during enumeration.
> 
> [...]

Applied to 5.13/scsi-fixes, thanks!

[1/1] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic
      https://git.kernel.org/mkp/scsi/c/56f396146af2

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-15  3:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11  3:04 [PATCH v2] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Matt Wang
2021-05-15  3:13 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.