Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2669343pxj; Mon, 31 May 2021 07:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf55E2V7mAsZdoObMsP01olW/eeUHb7SKARG1tHffBWt6Ig4No+muUEdm5WaJv+zq7dDxz X-Received: by 2002:a05:6638:3445:: with SMTP id q5mr21226381jav.120.1622472744221; Mon, 31 May 2021 07:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622472744; cv=none; d=google.com; s=arc-20160816; b=V2katJlVSxCkl/v6NQU/6PbNQ5j6Q6UWCMu5ZwKDTd6qKBX0v2QJKycZPvvQlTiVzK 93XDqbgoC5WqC5X56o/kA/64sBwWj5Mwf5V6AUxUp+hExY7sYybo9UZgI60SLw0QiC4n +s/ZX3Y/KUHYyviZLD7hdfwz5I/8qoYYWJGmhSpDacMEF+2DC7R14nROeUFy2+tSXvCD CTJ8hcx7itFQJh5vFvzh/XSMFZubflqQJP5zw4VSFL8tIz06rJlp4C5Usu6qAvHFnYhH vjF5MjWdPXq67s1dyYSnFTzeV1lEgKw7T0nXhVMMnGK3bv11RU3q6U1rE1i83rG1QEwX LRgQ== 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=tDjFJz2cf5uQXII7mIPM+YdEYhbIMKINwiMFIBQlC+rgaBQ5F4OxIVM8TYqRbTR8sP ozGw43d1fMG6NehiIpVsmmsHHuvaLuZGCv6dkPzpgZHutYkzGu5IliTUTaGcWyBTGdWX uwjB6Xltjb25Y9Fx+3r8Frtm+P/cGPK/Lxgysm6TtkA1hj8z+PoXeQHH8s/C0a6Au1+l YdUPHit4ZsSJM2OXeu1qrOFXfm6K2K94XALLTN7IWPJ6Cp7xmdffQ3roLGpjzNeYLBh4 a0OJ2KNNUpWONWgzSD2uaNQYDHkdL2PlZBhqHGMmSOtVKlq3PRtMnfym3nwxbh183HPf Xqgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RS+cY7CW; 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 5si16370447ilx.117.2021.05.31.07.52.11; Mon, 31 May 2021 07:52:24 -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=RS+cY7CW; 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 S233706AbhEaOwj (ORCPT + 99 others); Mon, 31 May 2021 10:52:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:38128 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233111AbhEaOC4 (ORCPT ); Mon, 31 May 2021 10:02:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D3576194B; Mon, 31 May 2021 13:37:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468248; bh=BCFSwPzx2HxKv/p9u44M95JwdRo+S1eHf49eYFKdEJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RS+cY7CWYk+K3AXlTc4PNLm7yNjSvhnW0nyOHNsjt2b6LE49Zaw5Btr67NLdxL3rY 8aYXScqzSHktbrgI+2yneul57bwO3+Oy8ii4D2A+uH2R1EKI2epwGkKMr3C6O+EmBP WS0gIMC9f4kF71pUrh1lAJiIWq9ZDXpTqX9MiYtM= 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.10 172/252] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Date: Mon, 31 May 2021 15:13:57 +0200 Message-Id: <20210531130703.851619561@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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