Re: [PATCH v2] drivers/usb/host/uhci-* : check buffer length to avoid memory overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 18 Jan 2013, Greg KH wrote:

> On Sat, Jan 12, 2013 at 11:18:03PM +0800, Chen Gang wrote:
> > 
> >   for function uhci_sprint_schedule:
> >     the buffer len is MAX_OUTPUT: 64 * 1024, which may not be enough:
> >       may loop UHCI_NUMFRAMES times (UHCI_NUMFRAMES is 1024)
> >       each time of loop may get more than 64 bytes
> >     so need check the buffer length to avoid memory overflow
> > 
> >   this patch fix it like this:
> >     at first, make enough room for buffering the exceeding contents
> >     judge the contents which written whether bigger than buffer length
> >     if bigger (the exceeding contents will be in the exceeding buffer)
> >       break current work flow, and return.
> > 
> >   also let the const string contents not seperated in second line.
> > 
> > 
> > 
> > Signed-off-by: Chen Gang <gang.chen@xxxxxxxxxxx>
> > ---
> >  drivers/usb/host/uhci-debug.c |  178 +++++++++++++++++++++++++++--------------
> >  drivers/usb/host/uhci-hcd.c   |   31 ++++---
> >  drivers/usb/host/uhci-q.c     |    2 +-
> >  3 files changed, 136 insertions(+), 75 deletions(-)
> 
> Alan, any objections to me taking this patch?

Gang:

This needs to be broken up into two distinct patches:

	One to fix the buffer-overflow problem;

	One to get rid of the line breaks in string constants.

Two totally separate goals like these should not be combined into a 
single patch.  Also, why did you change the comment in 
uhci_debug_lseek?

Apart from that, it looks fine.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux