linux_usbfs: op_handle_events: Protect against not finding the device-handle
We scan the list of open devices to find the device-handle based on the fd,
add a check to ensure that we've actually found the handle before continuing.
This fixes the following Coverity warning:
*** CID 62575: Explicit null dereferenced (FORWARD_NULL)
/libusb/os/linux_usbfs.c: 2594 in op_handle_events()
2588 hpriv = _device_handle_priv(handle);
2589 if (hpriv->fd == pollfd->fd)
2590 break;
2591 }
2592
2593 if (pollfd->revents & POLLERR) {
>>> CID 62575: Explicit null dereferenced (FORWARD_NULL)
>>> Dereferencing null pointer "hpriv".
2594 usbi_remove_pollfd(HANDLE_CTX(handle), hpriv->fd);
2595 usbi_handle_disconnect(handle);
2596 /* device will still be marked as attached if hotplug
monitor thread
2597 * hasn't processed remove event yet */
2598 usbi_mutex_static_lock(&linux_hotplug_lock);
2599 if (handle->dev->attached)
Signed-off-by: Hans de Goede <hdegoede@redhat.com>