Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp776114ybc; Sat, 16 Nov 2019 08:29:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzu7ISsNTz3ucfgC3PjDgTlbuB+rtf5+SP0G779inDPZy2Jlsn1l6gKebyP1tookbV5kwoi X-Received: by 2002:a17:906:5648:: with SMTP id v8mr11095627ejr.186.1573921767671; Sat, 16 Nov 2019 08:29:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573921767; cv=none; d=google.com; s=arc-20160816; b=bvM+16A6/SxR46YV5LT8dHf/SsFPJUwgJIoWUuwio4nuK4aAKsjMPm+JFkC6YCKwvT MeyUZI/Ywn4LFjOinD1nCE598sunk35dADWeRpR+GGA/4O3hEjbXPzO9pbLOcn6dZIWi dIJf2IrF1rbB/wi8pncWRBgWqfL+M+ywGtj8z4TfUY/BCwB0hrBVELcOlI/YWSduzmAq 2YM6uytTFHbHWpidOUv7x0WqwqOD3cHs8alM0vNgikLzY3WF2QZKiaXPY4V/kF2ErDfs S55bQdGtRgMHNx5RvliK4OfBW+5QJvebAlOn46/ytUUE1Hwm75XBQAhEGevG0FIuQ+CB jQEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JWB5jBoM0oLcAXLlCg2TPmTf26wzFWbXH12fMOAFQlA=; b=VGtNP5P40CVRuhh1wTEYsGgLmoztDGBAmOFdLUdVvTpt8UzeuDOjmCdQpS9y+2pEMt SlKKCwf4GEZDGLonuiPTqC0jHjYcUEgUKhY/9zzUNm8W6JC8FXkTW6J2/6CfoApyX0mU URnJ9q/tUvI51pKhIS4MQMn6zZ3B9TWVjarDhFwsL6MvjIOkg9BjgUCVAv9rK+SP/LTQ 7u7Qvgp4GolxqcnLpWSR6+kvxwQYMHLhk8eAvMBVqMwWOChJER7m7B67kJlhPrMuQzae hAVgotvi5JP7sevzFSnD3Q2i8j+gATmU03IAwmxrySc7CyOCRjy2LrV1S7MCQw7yHv45 sW4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tzJmfi2C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o19si9092188edz.393.2019.11.16.08.29.02; Sat, 16 Nov 2019 08:29:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tzJmfi2C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729903AbfKPQYh (ORCPT + 99 others); Sat, 16 Nov 2019 11:24:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:45942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728218AbfKPPmX (ORCPT ); Sat, 16 Nov 2019 10:42:23 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 94E4F2083E; Sat, 16 Nov 2019 15:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573918943; bh=/ZJI/4gyijIuk0UAleXk9pAGE4qXIMVC+2rzUpbTqLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tzJmfi2CzG2CktobJc+doFAUM/LtYcNj23X+2DrMgVT2kJaL78fv1SCrrQpQrInC0 hS565mRugBtpJmYGmlPxRhKEqwvuGSNZYPIkmbUxCTGCesGQdXEEW451j7uIZ3Hztf BukeDzOL2xM2ZOagaZAHHDh4fUBK6HUTYXzwWTNI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Finn Thain , Michael Schmitz , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 065/237] scsi: zorro_esp: Limit DMA transfers to 65535 bytes Date: Sat, 16 Nov 2019 10:38:20 -0500 Message-Id: <20191116154113.7417-65-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Finn Thain [ Upstream commit b7ded0e8b0d11b6df1c4e5aa23a26e6629c21985 ] The core driver, esp_scsi, does not use the ESP_CONFIG2_FENAB bit, so the chip's Transfer Counter register is only 16 bits wide (not 24). A larger transfer cannot work and will theoretically result in a failed command and a "DMA length is zero" error. Fixes: 3109e5ae0311 ("scsi: zorro_esp: New driver for Amiga Zorro NCR53C9x boards") Signed-off-by: Finn Thain Cc: Michael Schmitz Tested-by: Michael Schmitz Reviewed-by: Michael Schmitz Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/zorro_esp.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/scsi/zorro_esp.c b/drivers/scsi/zorro_esp.c index bb70882e6b56e..be79127db5946 100644 --- a/drivers/scsi/zorro_esp.c +++ b/drivers/scsi/zorro_esp.c @@ -245,7 +245,7 @@ static int fastlane_esp_irq_pending(struct esp *esp) static u32 zorro_esp_dma_length_limit(struct esp *esp, u32 dma_addr, u32 dma_len) { - return dma_len > 0xFFFFFF ? 0xFFFFFF : dma_len; + return dma_len > 0xFFFF ? 0xFFFF : dma_len; } static void zorro_esp_reset_dma(struct esp *esp) @@ -484,7 +484,6 @@ static void zorro_esp_send_blz1230_dma_cmd(struct esp *esp, u32 addr, scsi_esp_cmd(esp, ESP_CMD_DMA); zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); - zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI); scsi_esp_cmd(esp, cmd); } @@ -529,7 +528,6 @@ static void zorro_esp_send_blz1230II_dma_cmd(struct esp *esp, u32 addr, scsi_esp_cmd(esp, ESP_CMD_DMA); zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); - zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI); scsi_esp_cmd(esp, cmd); } @@ -574,7 +572,6 @@ static void zorro_esp_send_blz2060_dma_cmd(struct esp *esp, u32 addr, scsi_esp_cmd(esp, ESP_CMD_DMA); zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); - zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI); scsi_esp_cmd(esp, cmd); } @@ -599,7 +596,6 @@ static void zorro_esp_send_cyber_dma_cmd(struct esp *esp, u32 addr, zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); - zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI); if (write) { /* DMA receive */ @@ -649,7 +645,6 @@ static void zorro_esp_send_cyberII_dma_cmd(struct esp *esp, u32 addr, zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); - zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI); if (write) { /* DMA receive */ @@ -691,7 +686,6 @@ static void zorro_esp_send_fastlane_dma_cmd(struct esp *esp, u32 addr, zorro_esp_write8(esp, (esp_count >> 0) & 0xff, ESP_TCLOW); zorro_esp_write8(esp, (esp_count >> 8) & 0xff, ESP_TCMED); - zorro_esp_write8(esp, (esp_count >> 16) & 0xff, ESP_TCHI); if (write) { /* DMA receive */ -- 2.20.1