Skip to content
  • Roderick Colenbrander's avatar
    HID: uhid: fix timeout when probe races with IO · 67f8ecc5
    Roderick Colenbrander authored
    Many devices use userspace bluetooth stacks like BlueZ or Bluedroid in combination
    with uhid. If any of these stacks is used with a HID device for which the driver
    performs a HID request as part .probe (or technically another HID operation),
    this results in a deadlock situation. The deadlock results in a 5 second timeout
    for I/O operations in HID drivers, so isn't fatal, but none of the I/O operations
    have a chance of succeeding.
    
    The root cause for the problem is that uhid only allows for one request to be
    processed at a time per uhid instance and locks out other operations. This means
    that if a user space is creating a new HID device through 'UHID_CREATE', which
    ultimately triggers '.probe' through the HID layer. Then any HID request e.g. a
    read for calibration data would trigger a HID operation on uhid again, but it
    won't go out to userspace, because it is still stuck in UHID_CREATE.
    In addition bluetooth stacks are typically single threaded, so they woul...
    67f8ecc5