]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
USB: devio: Don't corrupt user memory
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 22 Sep 2017 20:43:46 +0000 (23:43 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Oct 2017 09:56:09 +0000 (11:56 +0200)
commitd328df9085b05f4f3ccdbe2ca1f980d72844641f
tree16050e6909230fea9eda942e4e9769d32dd905fb
parent1c918512a86de78b4f6c70ee6b7824eae5a3ee2d
USB: devio: Don't corrupt user memory

commit fa1ed74eb1c233be6131ec92df21ab46499a15b6 upstream.

The user buffer has "uurb->buffer_length" bytes.  If the kernel has more
information than that, we should truncate it instead of writing past
the end of the user's buffer.  I added a WARN_ONCE() to help the user
debug the issue.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/devio.c