mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 18:56:29 +00:00
usb_host: check ep pointer before using it
The Usb session allows for submitting packets even when the interface in question is not yet enabled. Enabling an interface will configure the udev members properly and is normally done implicitly during processing of an 'ALT_SETTING' packet. In case the interface was not enabled this leads to a page-fault in the USB host-controller driver as 'ep' is NULL. Fixes #3999.
This commit is contained in:
parent
6789ce8b83
commit
36b55e065a
@ -341,6 +341,14 @@ class Usb::Worker : public Genode::Weak_object<Usb::Worker>
|
||||
|
||||
usb_host_endpoint *ep = read ? _device->udev->ep_in[p.transfer.ep & 0x0f]
|
||||
: _device->udev->ep_out[p.transfer.ep & 0x0f];
|
||||
|
||||
if (!ep) {
|
||||
error("could not get ep: ", p.transfer.ep);
|
||||
dma_free(buf);
|
||||
p.error = Usb::Packet_descriptor::SUBMIT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
polling_interval = ep->desc.bInterval;
|
||||
|
||||
} else
|
||||
@ -382,6 +390,13 @@ class Usb::Worker : public Genode::Weak_object<Usb::Worker>
|
||||
Genode::memcpy(buf, _sink->packet_content(p), p.size());
|
||||
}
|
||||
|
||||
if (!ep) {
|
||||
error("could not get ep: ", p.transfer.ep);
|
||||
dma_free(buf);
|
||||
p.error = Usb::Packet_descriptor::SUBMIT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
urb *urb = usb_alloc_urb(p.transfer.number_of_packets, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
error("Failed to allocate isochronous URB");
|
||||
|
@ -352,6 +352,14 @@ class Usb::Worker : public Genode::Weak_object<Usb::Worker>
|
||||
|
||||
usb_host_endpoint *ep = read ? _device->udev->ep_in[p.transfer.ep & 0x0f]
|
||||
: _device->udev->ep_out[p.transfer.ep & 0x0f];
|
||||
|
||||
if (!ep) {
|
||||
error("could not get ep: ", p.transfer.ep);
|
||||
dma_free(buf);
|
||||
p.error = Usb::Packet_descriptor::SUBMIT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
polling_interval = ep->desc.bInterval;
|
||||
|
||||
} else
|
||||
@ -393,6 +401,13 @@ class Usb::Worker : public Genode::Weak_object<Usb::Worker>
|
||||
Genode::memcpy(buf, _sink->packet_content(p), p.size());
|
||||
}
|
||||
|
||||
if (!ep) {
|
||||
error("could not get ep: ", p.transfer.ep);
|
||||
dma_free(buf);
|
||||
p.error = Usb::Packet_descriptor::SUBMIT_ERROR;
|
||||
return false;
|
||||
}
|
||||
|
||||
urb *urb = usb_alloc_urb(p.transfer.number_of_packets, GFP_KERNEL);
|
||||
if (!urb) {
|
||||
error("Failed to allocate isochronous URB");
|
||||
|
Loading…
Reference in New Issue
Block a user