Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1413269
| From | Alan Stern <stern@rowland.harvard.edu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] usb: usbip: fix null pointer dereference |
| Date | 2016-06-03 16:30 +0200 |
| Message-ID | <rFYgN-4fh-13@gated-at.bofh.it> (permalink) |
| References | <rFSEq-MK-29@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, 3 Jun 2016, Krzysztof Opasiak wrote: > On 06/02/2016 03:22 PM, Sudip Mukherjee wrote: > > We have been dereferencing udc before checking it. Lets use it after it > > has been checked. > > > > To be honest I have mixed feelings about this patch. > > On one hand it prevents us from dereferencing potential NULL ptr what is > generally good. But on the other hand it seems to be a little bit > pointless overhead. This function is called only in one place, it's > internal function of vudc driver and in addition generally it is > currently impossible that this function will get NULL ptr as parameter > as it's value is taken from container_of(). Not to mention that if this > is NULL or garbage we will end up in NULL ptr dereference much earlier > before calling this function. > > So if there is something that you would like to fix with this patch and > you have a real problem with this function could you please provide us > some more details (for example stack trace)? If this patch is just to > prevent us from something that will never happen then I would rather to > not submit this. In my opinion if we get a NULL in this function this > means that we have some serious problem in UDC core and this check will > just mask this error. Normally in this situation, somebody would write a patch that removes these lines from get_gadget_descs(): if (!udc || !udc->driver || !udc->pullup) return -EINVAL; Or maybe (I'm not familiar with the driver so I don't know the best approach) changes the test to: if (!udc->driver || !udc->pullup) After all, there's no reason to check !udc if it is known beforehand that udc will never be NULL. Alan Stern
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] usb: usbip: fix null pointer dereference Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-06-02 20:00 +0200
Re: [PATCH] usb: usbip: fix null pointer dereference Krzysztof Opasiak <k.opasiak@samsung.com> - 2016-06-03 10:30 +0200
Re: [PATCH] usb: usbip: fix null pointer dereference Alan Stern <stern@rowland.harvard.edu> - 2016-06-03 16:30 +0200
Re: [PATCH] usb: usbip: fix null pointer dereference Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-06-05 20:00 +0200
Re: [PATCH] usb: usbip: fix null pointer dereference Krzysztof Opasiak <k.opasiak@samsung.com> - 2016-06-06 10:30 +0200
Re: [PATCH] usb: usbip: fix null pointer dereference Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2016-06-06 10:50 +0200
csiph-web