Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2638347pxj; Mon, 31 May 2021 07:08:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfE2G0I5EgvjfhiCm5qtEXGYRyaMF8TszrDX9Tig5/oRvGPVt/5ekf0uJRInZLUzOk+Lja X-Received: by 2002:a5d:818b:: with SMTP id u11mr16987196ion.36.1622470099741; Mon, 31 May 2021 07:08:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622470099; cv=none; d=google.com; s=arc-20160816; b=fYvz5zfi1lfIbUornpx1P79mF8r0ofeEfK+fzlI4RxnbRDnbWuj8enU/7TO60HGf4M T8go4KGfbAvfscvDfblgt8xtp1bbWTLCd8RGnNVp9EC+Ek+M3W86EaEjOaLT4oNWJLbI rihydoyy87Lo+SM5NF3MMSo2wx5Gi7/UBGoBwvGYI1GkVSUpwGQqHexFl53/2//NG1qG wgIJOz1UgQdINvdPZMhCkCZWbbP7PYaC0UGvnRcReepJuo1YC0Zxzs2us2IYKr9Y88Bc /oogabvEqDNF3nwNGXAd+0wroK9KOHPfgWZrfQfw1aUlUBsSjO9Zc1Rq9ovS7+gywxrY WkpA== 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=6WTv5HEhyB3ajxEdKuzhwjSOSr0W+iwVswPhSzEiLd0=; b=vex+VSiCb17tmVcRILT10LIOFssuUpJ6ADHG2RlIXAo0bSu9h3yeNR0TLmKsJH5lIg nIPMtoF4PNIjaNocFxcJROegq+auf8Bt3xMy5Pm9iNgf26lu5umC0ezbFpuBNGzKTvTb PaX3bzbzAc04fjeIQYUYXbo+9sf+a6Kggr/Z8p3/Zg1mLNpuFPc2DPhzBdeauC2Nigfu qop0uXUsR/mdz6S1mJf0cuZpgdSgHAPST4pTUUjKp2X7lf7U9/FsgXdsaFd/wPinRISA 3wZyNnEgCZWxY3fGb4Mz5ru+IOwVZDwMSAgzWDghMe+ga0R0rRT7HGtjJ8A4Fefzd0sn D26Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="EC00M8L/"; 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 s9si12846767jat.121.2021.05.31.07.08.06; Mon, 31 May 2021 07:08:19 -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="EC00M8L/"; 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 S233391AbhEaOID (ORCPT + 99 others); Mon, 31 May 2021 10:08:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:49500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231566AbhEaNm7 (ORCPT ); Mon, 31 May 2021 09:42:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9DC7461492; Mon, 31 May 2021 13:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467724; bh=pon5fKdHLxi+NILGNc50lSkTJKYRyySy5hnikaHr58Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EC00M8L/RF9bCJJ0sUVerRQ70CEugK8JEHtKnhFUV6JKZ3+vwKU+tbtI2bkIWCDsZ B/bceATXE0Cvw/OvXsmU0wNHx4SJidSsJJnqNLPIw4fkB30zfx5mVFpqAAUiD/SjdR mU5K5ysjp0TYRZSZEQgv/GfASIgIDOOM8WDnTmBQ= 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.14 56/79] scsi: BusLogic: Fix 64-bit system enumeration error for Buslogic Date: Mon, 31 May 2021 15:14:41 +0200 Message-Id: <20210531130637.797724145@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130636.002722319@linuxfoundation.org> References: <20210531130636.002722319@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 35380a58d3f0..48c1b590415d 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