Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2623832pxj; Mon, 31 May 2021 06:49:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwqdaiS4U5miMESGgwqom3c25gVtsLS4ctFYR8JVPSv/BzCzq2thtP2jMzGAeP4kA511SQj X-Received: by 2002:a05:6e02:118c:: with SMTP id y12mr1961834ili.288.1622468972402; Mon, 31 May 2021 06:49:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622468972; cv=none; d=google.com; s=arc-20160816; b=mLWppkY+NpHwp5oE73ApFvWr1Fwa8K2519oHk8uy1aiiVFmN7bcO5sHJre95uW2lsY 8XLBJvx73yoAzzzdg/fzEsbKLq6A4+PPgC6eqaUsSacNDz1hYNxTQELqgDUXDOakepKl poX2Ff4bx9aKtlSPMIYQwraj1x9xC5KFu+MjIffrgEV+oDlP43yo3KjjEISnjYCANP9/ p1RhR4D+Id0aAtmMu5gBUerJuqt31kGp282HAzvz8fd0CO8mmIq5qzIUc5kYaKur1wmD 34p0khEm79mbQ2U0T4v4k0ylaO4x3OQwyqUlsUbENrzSyMAwvzFNp/QCHRAR9AwBnZcM ntdg== 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=IpP6Qkv5AYwlG0aP1jwlkUUaoGJ6krxmiHe78gNnnBc=; b=On/daz8pKbLucIua0lztkMRlOImaKDj1QVkOCYHvHZmrVuYdtOABmGR9JUwoglYg6u loTN9B6xHuemdbgNBPmoKlf788r6nXp5kNJicYep+tZVXUgtAHzzgYrNH3MQwM6j1G19 yBYfjS0OgpxY26JCwgjiXnWM9gStpTnTmkZ3G13hVC6j5Yq20MkMXf5ODRdA2npbsKae 0SxSPhzYvXB7CQ3JIAJ+5C+TGJ+KfwvNLzeh3AB9bzaqRMf6ZGUN96ax6OhXFN+IGluQ hY07CKwsMAPg825A1GLzhWJiG8hARbMkVDvN2FxQlhKAlAs9doIsCpgCNnf55ZFBR/9J nu/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pN1OcWZ1; 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 y15si15276298ill.101.2021.05.31.06.49.18; Mon, 31 May 2021 06:49:32 -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=pN1OcWZ1; 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 S233058AbhEaNtv (ORCPT + 99 others); Mon, 31 May 2021 09:49:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:40216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232713AbhEaNeW (ORCPT ); Mon, 31 May 2021 09:34:22 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 920CD613F3; Mon, 31 May 2021 13:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467497; bh=r2zlUh1pZXvCNhM+q9Rg6U2Q68hTUG+6yv5YzOkjEZ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pN1OcWZ1AuMtp3tMCDuM8z646RmzwYFztjtqfg//sHklbUjHL2xLOx77JMbGWlwvz dqvfYQZFIjNrQSiSidZkQY3DehT2Cb4QJSrkAzBmyre9OB/IaZ+C84POnW38TOD+on sbWpdjsz1CIMKgApQxt2au0+nzTxbOCoEnEZ0SAU= 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 4.19 087/116] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Date: Mon, 31 May 2021 15:14:23 +0200 Message-Id: <20210531130643.097819206@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@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 0d4ffe0ae306..79b5c5457cc2 100644 --- a/drivers/scsi/BusLogic.c +++ b/drivers/scsi/BusLogic.c @@ -3081,11 +3081,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 8d47e2c88d24..1a33a4b28d45 100644 --- a/drivers/scsi/BusLogic.h +++ b/drivers/scsi/BusLogic.h @@ -821,7 +821,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