Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2746076pxj; Mon, 31 May 2021 09:41:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhSK70JaChuywBm5FW2SkaeDt0OM6mBKw2p39MG0POmR5nzxKkxI4sgOrtzqPs4ptzZNME X-Received: by 2002:a17:907:160a:: with SMTP id hb10mr23585106ejc.157.1622479264118; Mon, 31 May 2021 09:41:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479264; cv=none; d=google.com; s=arc-20160816; b=jDW7+B6n3yJNqjS6UsppOPn8xKhz8nIneyo68to13tW0PadUn6V+KZo5tGcBt1n9Ry zEpo2GII/RHs7F76R/a6rVeQ61+YpkOqbxWjp06W3JI7eFKTanjOZ9xNdCO7rCMr6a64 Yekfad2cZ4lXyM6Q8C+gRyCK2qCJTHOrvKWmKR0PCvf89FWjc85f7mxckJ1cHf9d+qc9 iGylnmkUmBGUPsNXY4LCjUUwX8n9moLB1K2/QRZYIXJoVdSw7SxZlio5xao1g38Gh9Jl jNpTgxJEmn79F4lP9MIjEduJG7fB3ahKNd50EhEnV3ER8nVaY3K2I1I7OiLG4ZLWV82G wP2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=RDnrf0PbD/JgkCxsopTDfS9GZ7GWU38IPbfDE4BcjhQ=; b=eIn1i+TN49FREGumWFYJEsBeKsUtH/hRrGgj1SPkkXxM0XfCnVQSDVYB8xKBTBzTDQ lfBwOqt0+OCyl7t4BpBDhMvtlg8SGEp9WTdMeIS112UDuFVMd0vjMU6sH1egOXxBXhsf m4qe9exdl38imoNEFxG08evzaxjz0xprcmklsUfSLD2risbS8xoP44eeIyqea//D1vL3 94u9fWZhZbx6/rBsAeBdl/AxP8ZNf6mXyqVInmJTo9KHM3HNhGKGjEqTCqVRvf3Q8h5J jFUICazU6jZOS2FHXRiQwEIRU7WXcXFMeT5EWUqCshRQMavp0ELpqq6y2gF2hwUNFo70 5auw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AUAQkIYM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm6si8178674edb.511.2021.05.31.09.40.41; Mon, 31 May 2021 09:41:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AUAQkIYM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234701AbhEaQjZ (ORCPT + 99 others); Mon, 31 May 2021 12:39:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:47164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232847AbhEaOuk (ORCPT ); Mon, 31 May 2021 10:50:40 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7244461C9C; Mon, 31 May 2021 13:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469453; bh=BCFSwPzx2HxKv/p9u44M95JwdRo+S1eHf49eYFKdEJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AUAQkIYMZrYsfluG9Bla4RHA6Y/j4+bra/+ACrBj7fG6dB2YKMP7A/ldjaAmujwQ/ KNhjmjtKlL3phR1mHhQgLcYvRNo3VNC7tEPwvkRMWFzBNAKgjxhWIKangD+KvaPEzf hqvLaY3Sycth3g2UbA7pKcp3V8yxT6rXzWKyfTnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Khalid Aziz , Matt Wang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.12 202/296] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Date: Mon, 31 May 2021 15:14:17 +0200 Message-Id: <20210531130710.674106812@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matt Wang [ Upstream commit 56f396146af278135c0ff958c79b5ee1bd22453d ] Commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit") 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 the commit above which switched the data pointer from u32 to void. Link: https://lore.kernel.org/r/C325637F-1166-4340-8F0F-3BCCD59D4D54@vmware.com Acked-by: Khalid Aziz Signed-off-by: Matt Wang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- 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.30.2