rpms/kernel/devel linux-2.6-sata-sg_init_one-oops.patch, NONE, 1.1 kernel-2.6.spec, 1.2876, 1.2877

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Dec 14 20:56:37 UTC 2006


Author: davej

Update of /cvs/dist/rpms/kernel/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv20333

Modified Files:
	kernel-2.6.spec 
Added Files:
	linux-2.6-sata-sg_init_one-oops.patch 
Log Message:
libata: don't initialize sg in ata_exec_internal() if DMA_NONE


linux-2.6-sata-sg_init_one-oops.patch:
 libata-core.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

--- NEW FILE linux-2.6-sata-sg_init_one-oops.patch ---
>From linux-kernel-owner at vger.kernel.org Mon Dec 11 17:16:05 2006
Return-path:
	<linux-kernel-owner+arjan=40infradead.org-S1762962AbWLKRPl at vger.kernel.org>
Envelope-to: arjan at infradead.org
Delivery-date: Mon, 11 Dec 2006 17:16:05 +0000
Received: from vger.kernel.org ([209.132.176.167]) by
	pentafluge.infradead.org with esmtp (Exim 4.63 #1 (Red Hat Linux)) id
	1Gtol2-00036I-KX for arjan at infradead.org; Mon, 11 Dec 2006 17:16:05 +0000
Received: (majordomo at vger.kernel.org) by vger.kernel.org via listexpand id
	S1762962AbWLKRPl (ORCPT <rfc822;arjan at infradead.org>); Mon, 11 Dec 2006
	12:15:41 -0500
Received: (majordomo at vger.kernel.org) by vger.kernel.org id
	S1762972AbWLKRPk (ORCPT <rfc822;linux-kernel-outgoing>); Mon, 11 Dec 2006
	12:15:40 -0500
Received: from an-out-0708.google.com ([209.85.132.247]:63445 "EHLO
	an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with
	ESMTP id S1762962AbWLKRPj (ORCPT <rfc822;linux-kernel at vger.kernel.org>);
	Mon, 11 Dec 2006 12:15:39 -0500
Received: by an-out-0708.google.com with SMTP id b33so279269ana for
	<linux-kernel at vger.kernel.org>; Mon, 11 Dec 2006 09:15:38 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:date:from:to:cc:subject:message-id:references:mime-version:content-type:content-disposition:in-reply-to:user-agent;
	b=ATHT5+IJyhawAcHUoTz0Xw4R87X6W1LyNdwLyhXyywtNk7OPVdRPH0Ii3/vPrtEfXNcPnt4e83qv7sCyvaySb6hIESAx4MKyDpMisfUyq8cnPhSRs5kjm6dLjnJa4TkGx0u5MAHToRFMr3+4a1j3wcO6NPmpMQ1/PQHfq9O2lVE=
Received: by 10.100.58.4 with SMTP id g4mr8883061ana.1165857338475; Mon, 11
	Dec 2006 09:15:38 -0800 (PST)
Received: from htj.dyndns.org ( [221.139.199.108]) by mx.google.com with
	ESMTP id d35sm8900343and.2006.12.11.09.15.36; Mon, 11 Dec 2006 09:15:38
	-0800 (PST)
Received: by htj.dyndns.org (Postfix, from userid 1000) id EA441183C1; Tue,
	12 Dec 2006 02:15:31 +0900 (KST)
Date:	Tue, 12 Dec 2006 02:15:31 +0900
From:	Tejun Heo <htejun at gmail.com>
To:	Jeff Garzik <jgarzik at pobox.com>
Cc:	Arnd Bergmann <arnd.bergmann at de.ibm.com>, linux-ide at vger.kernel.org, linuxppc-dev at ozlabs.org, linux-kernel at vger.kernel.org
Subject: [PATCH] libata: don't initialize sg in ata_exec_internal() if
	DMA_NONE (take #2)
Message-ID: <20061211171531.GC18947 at htj.dyndns.org>
References: <200612081914.41810.arnd.bergmann at de.ibm.com>
	 <20061211140258.GB18947 at htj.dyndns.org> <457D7F5C.8040609 at pobox.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <457D7F5C.8040609 at pobox.com>
User-Agent: Mutt/1.5.13 (2006-08-11)
Sender:	linux-kernel-owner at vger.kernel.org
Precedence: bulk
X-Mailing-List:	linux-kernel at vger.kernel.org
X-Evolution-Source: imap://arjan@pentafluge.infradead.org/
Content-Transfer-Encoding: 8bit

Calling sg_init_one() with NULL buf causes oops on certain
configurations.  Don't initialize sg in ata_exec_internal() if
DMA_NONE and make the function complain if @buf is NULL when dma_dir
isn't DMA_NONE.  While at it, fix comment.

The problem is discovered and initial patch was submitted by Arnd
Bergmann.

Signed-off-by: Tejun Heo <htejun at gmail.com>
Cc: Arnd Bergmann <arnd.bergmann at de.ibm.com>
---

Modified as suggested.

Thanks.

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 011c0a8..0d51d13 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1332,7 +1332,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
 }
 
 /**
- *	ata_exec_internal_sg - execute libata internal command
+ *	ata_exec_internal - execute libata internal command
  *	@dev: Device to which the command is sent
  *	@tf: Taskfile registers for the command and the result
  *	@cdb: CDB for packet command
@@ -1353,11 +1353,17 @@ unsigned ata_exec_internal(struct ata_device *dev,
 			   struct ata_taskfile *tf, const u8 *cdb,
 			   int dma_dir, void *buf, unsigned int buflen)
 {
-	struct scatterlist sg;
+	struct scatterlist *psg = NULL, sg;
+	unsigned int n_elem = 0;
 
-	sg_init_one(&sg, buf, buflen);
+	if (dma_dir != DMA_NONE) {
+		WARN_ON(!buf);
+		sg_init_one(&sg, buf, buflen);
+		psg = &sg;
+		n_elem++;
+	}
 
-	return ata_exec_internal_sg(dev, tf, cdb, dma_dir, &sg, 1);
+	return ata_exec_internal_sg(dev, tf, cdb, dma_dir, psg, n_elem);
 }
 
 /**
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at 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/dist/rpms/kernel/devel/kernel-2.6.spec,v
retrieving revision 1.2876
retrieving revision 1.2877
diff -u -r1.2876 -r1.2877
--- kernel-2.6.spec	14 Dec 2006 20:41:39 -0000	1.2876
+++ kernel-2.6.spec	14 Dec 2006 20:56:35 -0000	1.2877
@@ -438,6 +438,7 @@
 # SATA Bits
 Patch2200: linux-2.6-sata-promise-pata-ports.patch
 Patch2201: linux-2.6-sata-ahci-suspend.patch
+Patch2202: linux-2.6-sata-sg_init_one-oops.patch
 
 # ACPI bits
 
@@ -946,6 +947,8 @@
 #%patch2200 -p1
 # Fix AHCI Suspend.
 #%patch2201 -p1
+# libata: don't initialize sg in ata_exec_internal() if DMA_NONE
+%patch2202 -p1
 
 # ACPI patches
 
@@ -1785,6 +1788,7 @@
 %changelog
 * Thu Dec 14 2006 Dave Jones <davej at redhat.com>
 - 2.6.20rc1
+- libata: don't initialize sg in ata_exec_internal() if DMA_NONE
 
 * Wed Dec 13 2006 Dave Jones <davej at redhat.com>
 - Kill off -kdump for 686.




More information about the fedora-cvs-commits mailing list