From owner-freebsd-current Fri Dec 20 4:11:20 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E11E137B401 for ; Fri, 20 Dec 2002 04:11:18 -0800 (PST) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id B01FF43EE5 for ; Fri, 20 Dec 2002 04:11:17 -0800 (PST) (envelope-from ticso@cicely8.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [IPv6:3ffe:400:8d0:301:200:92ff:fe9b:20e7]) by srv1.cosmo-project.de (8.12.5/8.12.5) with ESMTP id gBKCB7qd010450 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Fri, 20 Dec 2002 13:11:12 +0100 (CET) (envelope-from ticso@cicely8.cicely.de) Received: from cicely8.cicely.de (cicely8.cicely.de [10.1.1.10]) by cicely5.cicely.de (8.12.6/8.12.6) with ESMTP id gBKCB5fQ003935 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Fri, 20 Dec 2002 13:11:06 +0100 (CET) (envelope-from ticso@cicely8.cicely.de) Received: from cicely8.cicely.de (localhost [127.0.0.1]) by cicely8.cicely.de (8.12.6/8.12.6) with ESMTP id gBKCB45W001852; Fri, 20 Dec 2002 13:11:04 +0100 (CET) (envelope-from ticso@cicely8.cicely.de) Received: (from ticso@localhost) by cicely8.cicely.de (8.12.6/8.12.6/Submit) id gBKCB30x001851; Fri, 20 Dec 2002 13:11:03 +0100 (CET) Date: Fri, 20 Dec 2002 13:11:01 +0100 From: Bernd Walter To: Matthew Dillon Cc: Nate Lawson , freebsd-current@FreeBSD.ORG Subject: Re: UMASS USB bug? (getting the Sony disk-on-key device working) Message-ID: <20021220121100.GA658@cicely8.cicely.de> Reply-To: ticso@cicely.de References: <200212200111.gBK1BW0h026510@apollo.backplane.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200212200111.gBK1BW0h026510@apollo.backplane.com> X-Operating-System: FreeBSD cicely8.cicely.de 5.0-CURRENT i386 User-Agent: Mutt/1.5.1i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, Dec 19, 2002 at 05:11:32PM -0800, Matthew Dillon wrote: > I found another couple of bugs, this time in OHCI's DMA > buffer chaining code. Great. > A patch for this with additional debugging code is > included below (for current). There are two bugs. > I do not know if -stable is effected. > > First, the calculation of dataphysend is totally bogus. > You can just take the physical address and add (len - 1) > to it. You have to take the virtual address, add len - 1 > to it, and convert it to a physical address. I can > crash my machine simply by doing a > > 'newfs -f 1024 -b 8192 /dev/da2s1a' > > On the disk-on-key USB device. > > Second, I believe the OpenBSD and NetBSD code is broken. > The range can be one or two pages, but the remaining bytes > may be less then one page and this has to be taken into > account. The NetBSD code is already different: 1.48 (augustss 15-Sep-99): /* The OHCI hardware can handle at most one page crossing. */ 1.48 (augustss 15-Sep-99): if (OHCI_PAGE(dataphys) == dataphysend || 1.48 (augustss 15-Sep-99): OHCI_PAGE(dataphys) + OHCI_PAGE_SIZE == dataphysend) { 1.48 (augustss 15-Sep-99): /* we can handle it in this TD */ 1.48 (augustss 15-Sep-99): curlen = len; 1.48 (augustss 15-Sep-99): } else { 1.48 (augustss 15-Sep-99): /* must use multiple TDs, fill as much as possible. */ 1.120 (augustss 03-Feb-02): curlen = 2 * OHCI_PAGE_SIZE - 1.48 (augustss 15-Sep-99): (dataphys & (OHCI_PAGE_SIZE-1)); 1.78 (augustss 20-Mar-00): /* the length must be a multiple of the max size */ 1.78 (augustss 20-Mar-00): curlen -= curlen % UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize); 1.78 (augustss 20-Mar-00): #ifdef DIAGNOSTIC 1.78 (augustss 20-Mar-00): if (curlen == 0) 1.128 (provos 27-Sep-02): panic("ohci_alloc_std: curlen == 0"); 1.78 (augustss 20-Mar-00): #endif 1.48 (augustss 15-Sep-99): } To bad we did not catch it. -- B.Walter COSMO-Project http://www.cosmo-project.de ticso@cicely.de Usergroup info@cosmo-project.de To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message