]> git.baikalelectronics.ru Git - uboot.git/commit
efi_loader: fix use after free in receive path
authorPatrick Wildt <patrick@blueri.se>
Wed, 7 Oct 2020 09:04:33 +0000 (11:04 +0200)
committerHeinrich Schuchardt <xypron.glpk@gmx.de>
Mon, 19 Oct 2020 20:59:53 +0000 (22:59 +0200)
commit036e34fea16d2c71d45c22fac65d1d7ee980700f
tree6ec73e69086dd764748b7c26bd60ddc4f07af6ec
parent981630506e2d91d2c88e4ddf40d230d9771501c9
efi_loader: fix use after free in receive path

With DM enabled the ethernet code will receive a packet, call
the push method that's set by the EFI network implementation
and then free the packet.  Unfortunately the push methods only
sets a flag that the packet needs to be handled, but the code
that provides the packet to an EFI application runs after the
packet has already been freed.

To rectify this issue, adjust the push method to accept the packet
and store it in a temporary buffer.  The EFI application then gets
the data copied from that buffer.  This way the packet is cached
until is is needed.

The DM Ethernet stack tries to receive 32 packets at once, thus
we better allocate as many buffers as the stack.

Signed-off-by: Patrick Wildt <patrick@blueri.se>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
lib/efi_loader/efi_net.c