Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Silicon/Synopsys/DesignWare: DwEmacSnpDxe: Fix bug in EmacGetDmaStatus
The EFI spec (see UEFI 2.10, 24.1.12) requires EFI_SIMPLE_NETWORK's GetStatus() method to handle NULL InterruptStatus pointers by not reading nor clearing the interrupt status from the device. However, EmacGetDmaStatus (part of the DwEmacSnpDxe GetStatus() implementation) did not correctly handle NULL IrqStat, despite already being tagged as an OPTIONAL argument. This made calling GetStatus() with a NULL pointer (for example, the call in MnpRecycleTxBuf) either corrupt memory or straight-up crash. Make it EFI spec compliant, by adding proper NULL pointer checks around RI_SET_MSK and TI_SET_MSK retrieval/clearing. Signed-off-by: Yang Wang <wangyzhaoz@163.com> [ardb: update commit log according to Pedro's suggestion] Acked-by: Pedro Falcato <pedro.falcato@gmail.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
- Loading branch information