From mboxrd@z Thu Jan 1 00:00:00 1970 References: <25f8de8836cc6c592e70cd662b61d0a2@hamnavoe.com> From: Gorka Guardiola Content-Type: text/plain; charset=us-ascii In-Reply-To: <25f8de8836cc6c592e70cd662b61d0a2@hamnavoe.com> Message-Id: Date: Thu, 14 Feb 2013 20:54:00 +0100 To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (1.0) Subject: Re: [9fans] usb serial bug Topicbox-Message-UUID: 179169bc-ead8-11e9-9d60-3106f5b1d025 Yes, I am looking into it and just saw this. G. On Feb 14, 2013, at 8:24 PM, Richard Miller <9fans@hamnavoe.com> wrote: > I said: > >>> The current Plan 9 usb architecture perpetuates the confusion by >>> referring to them both with one name epN.1, but you still have to open >>> them both independently. > > Erik replied: >> in that case, shouldn't these three blocks be reverted? > > Erik is right, I was talking through my hat. It's OK to open bulk > endpoints read/write, and the kernel will do the right thing. The > actual problem, which neither of us had spotted although it was > staring us in the face, is this: > > if((ep->dir == Ein || ep->dir == Eboth) && epin == -1) > epin = ep->id; > if((ep->dir == Ein || ep->dir == Eboth) && epout == -1) > epout = ep->id; > > Notice the two occurrences of Ein? The second one obviously should > be Eout. It was a typo (mine, I blush to admit). > > My usb serial adapter uses the same ep number for input and output, > so my testing didn't reveal this error. I think the same typo will > account for the double-free bug which Jeff (and Lucio on 4 Feb) reported. > > Erik, Jeff, Lucio - please try changing the offending Ein to Eout in > /sys/src/cmd/usb/serial/serial.c:721 and see if your troubles are resolved. > >