[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/kernel/F-7 linux-2.6-scsi-bounce-isa.patch, NONE, 1.1 kernel-2.6.spec, 1.3170, 1.3171



Author: davej

Update of /cvs/pkgs/rpms/kernel/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32485

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-scsi-bounce-isa.patch 
Log Message:
* Fri May 18 2007 Dave Jones <davej redhat com>
- Fix old SCSI adapter crashes with CD-ROM.


linux-2.6-scsi-bounce-isa.patch:

--- NEW FILE linux-2.6-scsi-bounce-isa.patch ---
>From davej  Tue May  8 12:13:20 2007
Return-path: <linux-kernel-owner+davej=40kernelslacker org-S934907AbXEHQNA vger kernel org>
X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on
	gelk.kernelslacker.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham
	version=3.1.8
Envelope-to: davej kernelslacker org
Delivery-date: Tue, 08 May 2007 17:13:14 +0100
Received: from testure.choralone.org [194.9.77.134]
	by gelk.kernelslacker.org with IMAP (fetchmail-6.3.6)
	for <davej localhost> (single-drop); Tue, 08 May 2007 12:13:20 -0400 (EDT)
Received: from vger.kernel.org ([209.132.176.167])
	by testure.choralone.org with esmtp (Exim 4.63)
	(envelope-from <linux-kernel-owner+davej=40kernelslacker org-S934907AbXEHQNA vger kernel org>)
	id 1HlSJO-0003f4-9V
	for davej kernelslacker org; Tue, 08 May 2007 17:13:14 +0100
Received: (majordomo vger kernel org) by vger.kernel.org via listexpand
	id S934907AbXEHQNA (ORCPT <rfc822;davej kernelslacker org>);
	Tue, 8 May 2007 12:13:00 -0400
Received: (majordomo vger kernel org) by vger.kernel.org id S934686AbXEHQM7
	(ORCPT <rfc822;linux-kernel-outgoing>);
	Tue, 8 May 2007 12:12:59 -0400
Received: from outpipe-village-512-1.bc.nu ([81.2.110.250]:59356 "EHLO
	the-village.bc.nu" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org
	with ESMTP id S934347AbXEHQM6 (ORCPT
	<rfc822;linux-kernel vger kernel org>);
	Tue, 8 May 2007 12:12:58 -0400
Received: from the-village.bc.nu (localhost.localdomain [127.0.0.1])
	by the-village.bc.nu (8.13.8/8.13.8) with ESMTP id l48GHApu023443;
	Tue, 8 May 2007 17:17:11 +0100
Date:	Tue, 8 May 2007 17:17:10 +0100
From:	Alan Cox <alan lxorguk ukuu org uk>
To:	linux-scsi vger kernel org, akpm osdl org,
	linux-kernel vger kernel org
Subject: [PATCH]: Fix old SCSI adapter crashes with CD-ROM (take 2)
Message-ID: <20070508171710 1ac730cd the-village bc nu>
X-Mailer: Claws Mail 2.9.1 (GTK+ 2.10.8; i386-redhat-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Sender:	linux-kernel-owner vger kernel org
Precedence: bulk
X-Mailing-List:	linux-kernel vger kernel org
Status: RO
Content-Length: 2787
Lines: 84

The CD-ROM layer doesn't bounce requests for old ISA controllers (and
nor should it). However they get injected into the SCSI layer via
sr_ioctl which also doesn't bounce them and SCSI then passes the buffer
along to a device with unchecked_isa_dma set which either panics or
truncates the buffer to 24bits.

According to Jens the right long term fix is for the CD layer to route
the requests differently but in the mean time this has been tested by a
victim and verified to sort the problem out. For the other 99.9% of users
it's a no-op and doesn't bounce data.

Signed-off-by: Alan Cox <alan redhat com>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.21-rc6-mm1/drivers/scsi/sr_ioctl.c linux-2.6.21-rc6-mm1/drivers/scsi/sr_ioctl.c
--- linux.vanilla-2.6.21-rc6-mm1/drivers/scsi/sr_ioctl.c	2007-04-12 14:14:45.000000000 +0100
+++ linux-2.6.21-rc6-mm1/drivers/scsi/sr_ioctl.c	2007-05-08 16:55:01.446661608 +0100
@@ -187,9 +187,10 @@
 	struct scsi_sense_hdr sshdr;
 	int result, err = 0, retries = 0;
 	struct request_sense *sense = cgc->sense;
-
+	void *zebedee = cgc->buffer;
+	
 	SDev = cd->device;
-
+	
 	if (!sense) {
 		sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL);
 		if (!sense) {
@@ -197,7 +198,22 @@
 			goto out;
 		}
 	}
-
+	
+	if (cgc->buflen && cd->device->host->unchecked_isa_dma) {
+		switch(cgc->data_direction) {
+			case DMA_NONE:
+				break;
+			case DMA_FROM_DEVICE:
+			case DMA_TO_DEVICE:
+				zebedee = kmalloc(cgc->buflen, GFP_KERNEL|GFP_DMA);
+				if (zebedee ==NULL) {
+					err = -ENOMEM;
+					goto out;
+				}
+		}
+		if (cgc->data_direction == DMA_TO_DEVICE)
+			memcpy(zebedee, cgc->buffer, cgc->buflen);
+	}
       retry:
 	if (!scsi_block_when_processing_errors(SDev)) {
 		err = -ENODEV;
@@ -206,10 +222,15 @@
 
 	memset(sense, 0, sizeof(*sense));
 	result = scsi_execute(SDev, cgc->cmd, cgc->data_direction,
-			      cgc->buffer, cgc->buflen, (char *)sense,
+			      zebedee, cgc->buflen, (char *)sense,
 			      cgc->timeout, IOCTL_RETRIES, 0);
 
 	scsi_normalize_sense((char *)sense, sizeof(*sense), &sshdr);
+	
+	if (zebedee != cgc->buffer) {
+		if (cgc->data_direction == DMA_FROM_DEVICE)
+			memcpy(cgc->buffer, zebedee, cgc->buflen);
+	}
 
 	/* Minimal error checking.  Ignore cases we know about, and report the rest. */
 	if (driver_byte(result) != 0) {
@@ -266,6 +287,8 @@
 
 	/* Wake up a process waiting for device */
       out:
+	if (zebedee != cgc->buffer)
+		kfree(zebedee);	/* Time for bed */
 	if (!cgc->sense)
 		kfree(sense);
 	cgc->stat = err;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo vger kernel org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-7/kernel-2.6.spec,v
retrieving revision 1.3170
retrieving revision 1.3171
diff -u -r1.3170 -r1.3171
--- kernel-2.6.spec	18 May 2007 19:37:09 -0000	1.3170
+++ kernel-2.6.spec	18 May 2007 19:40:07 -0000	1.3171
@@ -544,7 +544,8 @@
 Patch1070: linux-2.6-sleepon.patch
 
 # SCSI bits.
-Patch1106: linux-2.6-scsi-cpqarray-set-master.patch
+Patch1100: linux-2.6-scsi-bounce-isa.patch
+Patch1101: linux-2.6-scsi-cpqarray-set-master.patch
 
 # NFS bits.
 Patch1201: linux-2.6-NFSD-badness.patch
@@ -1270,8 +1271,10 @@
 #
 # SCSI Bits.
 #
+# Fix old SCSI adapter crashes with CD-ROM
+%patch1100 -p1
 # fix cpqarray pci enable
-%patch1106 -p1
+%patch1101 -p1
 
 #
 # Various NFS/NFSD fixes.
@@ -2395,6 +2398,9 @@
 
 %changelog
 * Fri May 18 2007 Dave Jones <davej redhat com>
+- Fix old SCSI adapter crashes with CD-ROM.
+
+* Fri May 18 2007 Dave Jones <davej redhat com>
 - pata_pcmcia.c: add card ident for jvc cdrom
 
 * Fri May 18 2007 John W. Linville <linville redhat com>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]