dde_linux/usb/legacy: only free completed URBs

In case a USB client cancelled URBs, do not free them, wait until the
packets/URBs are acked by the USB session.

issue #4557
This commit is contained in:
Sebastian Sumpf 2022-07-06 18:57:03 +02:00 committed by Christian Helmuth
parent 87aa456bfd
commit 96b147b63d
2 changed files with 8 additions and 3 deletions

View File

@ -112,7 +112,6 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
return 0;
}
void usb_free_urb(struct urb *urb)
{
if (!urb)
@ -121,6 +120,10 @@ void usb_free_urb(struct urb *urb)
/* free 'Urb' object */
if (urb->hcpriv) {
Urb *u = (Urb*)urb->hcpriv;
/* URB is not fred through packet stream */
if (u->completed() == false) return;
u->~Urb();
kfree(urb->hcpriv);
}

View File

@ -139,10 +139,12 @@ class Urb : public Usb::Completion
}
}
if (_urb.complete) _urb.complete(&_urb);
_completed = true;
if (_urb.complete) _urb.complete(&_urb);
}
bool completed() const { return _completed; }
};