Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1375534

Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence

From chunfeng yun <chunfeng.yun@mediatek.com>
Newsgroups linux.kernel
Subject Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence
Date 2016-04-11 09:20 +0200
Message-ID <rmEiD-1Ws-27@gated-at.bofh.it> (permalink)
References <rlAAq-1tY-29@gated-at.bofh.it> <rlFgK-4ZO-15@gated-at.bofh.it> <rmAoG-7sx-15@gated-at.bofh.it> <rmCqt-vD-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2016-04-11 at 08:07 +0300, Felipe Balbi wrote:
> Hi,
> 
> chunfeng yun <chunfeng.yun@mediatek.com> writes:
> > On Fri, 2016-04-08 at 07:07 -0700, Greg Kroah-Hartman wrote:
> >> On Fri, Apr 08, 2016 at 05:08:03PM +0800, Chunfeng Yun wrote:
> >> > NULL pointer dereferrence will happen when class driver
> >> > wants to allocate zero length buffer and pool_max[0]
> >> > can't be used, so skip reserved pool in this case.
> >> 
> >> Why would a driver want to allocate a 0 length buffer?  What driver does
> >> this?
> > It's misc/usbtest.c
> 
> that'll do what you ask it to do with the userspace tool testusb. Are
> you trying to pass a size of 0 ?
> 
No, I just ran "testusb -t10" which called test_ctrl_queue().
In this function, sub-case 8 passed a parameter @len as 0 to
simple_alloc_urb(), and then it tried to allocate a 0-length buffer.

> >> Shouldn't we fix that issue instead?
> > I don't know which way is better, but it seems simple to fix it up in
> > buffer.c 
> 
> I think we should, really, avoid a 0-length allocation, but passing a
> size of 0 to testusb isn't very good either ;-) How are you calling
> testusb ?
> 
As explained above.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] usb: core: buffer: avoid NULL pointer dereferrence Chunfeng Yun <chunfeng.yun@mediatek.com> - 2016-04-08 11:10 +0200
  Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-04-08 16:10 +0200
    Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence Alan Stern <stern@rowland.harvard.edu> - 2016-04-08 17:30 +0200
    Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence chunfeng yun <chunfeng.yun@mediatek.com> - 2016-04-11 05:10 +0200
      Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-04-11 07:20 +0200
        Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence chunfeng yun <chunfeng.yun@mediatek.com> - 2016-04-11 09:20 +0200
          Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence Felipe Balbi <felipe.balbi@linux.intel.com> - 2016-04-11 10:30 +0200
          Re: [PATCH] usb: core: buffer: avoid NULL pointer dereferrence Alan Stern <stern@rowland.harvard.edu> - 2016-04-11 16:50 +0200

csiph-web