]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[efi] Leave USB endpoint descriptors in existence until device is removed
authorMichael Brown <mcb30@ipxe.org>
Tue, 29 Sep 2020 13:26:54 +0000 (14:26 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 29 Sep 2020 13:26:54 +0000 (14:26 +0100)
commitfbb776f2f2d6e7f510a985af55ee34eb963ba9a2
tree4ab240f280714e2701bf77a2bfc7cb63cf34b38b
parentf42ba772c8050da266b69504efff8e16f2fda8c2
[efi] Leave USB endpoint descriptors in existence until device is removed

Some UEFI USB drivers (observed with the keyboard driver on a
Microsoft Surface Go) will react to an asynchronous USB transfer
failure by terminating the transfer from within the completion
handler.  This closes the USB endpoint and, in the current
implementation, frees the containing structure.

This can lead to use-after-free bugs after the UEFI USB driver's
completion handler returns, since the calling code in iPXE expects
that a completion handler will not perform a control-flow action such
as terminating the transfer.

Fix by leaving the USB endpoint structure allocated until the device
is finally removed, as is already done (as an optimisation) for
control and bulk transfers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_usb.c