lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 15 Feb 2008 15:49:34 +1030
From:	David Newall <davidn@...idnewall.com>
To:	Greg KH <greg@...ah.com>
CC:	linux-usb@...r.kernel.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Handshaking on USB serial devices

Greg KH wrote:
> On Thu, Feb 14, 2008 at 07:55:44PM +1030, David Newall wrote:
>   
>> The current 2.6 driver maintains it's own buffer.  I think that's a bad
>> thing: usbserial already buffers writes, and the extra buffer copy seems
>> unnecessary, however it does solve the putchar problem.  Buffered (i.e.
>> by the 2.6 series pl2303 driver) data is written as soon as practicable,
>> regardless of CTS/DTR.  The same general workaround, but placed in
>> pl2303_send seems correct to me; that is, stop submitting write urbs
>> when the remote end lowers CTS/DTR, and trigger the resume from the
>> interrupt callback (specifically in update_line_status.)
>>     
>
> Where does the usbserial core buffer writes on 2.6?  The serial_write()
> function just passes the data straight down to the usb-serial child
> driver directly, no copying or buffering happens that I can see.
>   

You're right.  I haven't examined the 2.6 stack as closely as the 2.4. 
I noticed the buffer in 2.6 pl2303, but didn't check 2.6 usb-serial.  I
think I prefer the buffer in usb-serial, because its centralised rather
than in each driver, but I'm not going to step up to the plate and
propose changing that!

>> To make it clear: Even aside from the buffer in 2.6's pl2303.c, there's
>> a race: An in-flight write URB can fill all hardware buffers, making
>> unsafe what previously appeared to be a safe write.  I think it's
>> essential to delay submission of the URB on a stop-transmit condition.
>>     
>
> It's up to the individual driver to know when their buffers are filled
> up.  The big problem is, a lot of these cheap usb-serial devices (like
> the pl2303) don't have a way to report the uart queue filled-state back
> to the host, so things can easily get over-run as you have found out.
>   

My understanding of the problem has developed over the last couple of
days; going from wrist-deep to elbow-deep into the guts of things does
that.  There is a problem, and the solution I've been developing
addresses it, but maybe there's a simpler answer.  Hope to have a patch
together soon.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ