mirror of https://github.com/ipxe/ipxe.git
[efi] Nullify interfaces unconditionally on error and shutdown paths
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/186/head
parent
f47a45ea2d
commit
fb91542f2a
|
@ -326,9 +326,9 @@ static int efi_block_hook ( unsigned int drive, struct uri **uris,
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( sandev, "EFIBLK %#02x could not uninstall protocols: "
|
||||
"%s\n", sandev->drive, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_block ( &block->block_io );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_block ( &block->block_io );
|
||||
err_install:
|
||||
if ( ! leak ) {
|
||||
free ( block->path );
|
||||
|
@ -377,9 +377,9 @@ static void efi_block_unhook ( unsigned int drive ) {
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( sandev, "EFIBLK %#02x could not uninstall protocols: "
|
||||
"%s\n", sandev->drive, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_block ( &block->block_io );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_block ( &block->block_io );
|
||||
|
||||
/* Free device path */
|
||||
if ( ! leak ) {
|
||||
|
|
|
@ -1652,10 +1652,10 @@ int efi_pxe_install ( EFI_HANDLE handle, struct net_device *netdev ) {
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( pxe, "PXE %s could not uninstall: %s\n",
|
||||
pxe->name, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_pxe ( &pxe->base );
|
||||
efi_nullify_apple ( &pxe->apple );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_pxe ( &pxe->base );
|
||||
efi_nullify_apple ( &pxe->apple );
|
||||
err_install_protocol:
|
||||
if ( ! leak )
|
||||
ref_put ( &pxe->refcnt );
|
||||
|
@ -1695,10 +1695,10 @@ void efi_pxe_uninstall ( EFI_HANDLE handle ) {
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( pxe, "PXE %s could not uninstall: %s\n",
|
||||
pxe->name, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_pxe ( &pxe->base );
|
||||
efi_nullify_apple ( &pxe->apple );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_pxe ( &pxe->base );
|
||||
efi_nullify_apple ( &pxe->apple );
|
||||
|
||||
/* Remove from list and drop list's reference */
|
||||
list_del ( &pxe->list );
|
||||
|
|
|
@ -1816,12 +1816,12 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( snpdev, "SNPDEV %p could not uninstall: %s\n",
|
||||
snpdev, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_snp ( &snpdev->snp );
|
||||
efi_nullify_nii ( &snpdev->nii );
|
||||
efi_nullify_name2 ( &snpdev->name2 );
|
||||
efi_nullify_load_file ( &snpdev->load_file );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_snp ( &snpdev->snp );
|
||||
efi_nullify_nii ( &snpdev->nii );
|
||||
efi_nullify_name2 ( &snpdev->name2 );
|
||||
efi_nullify_load_file ( &snpdev->load_file );
|
||||
err_install_protocol_interface:
|
||||
if ( ! leak )
|
||||
free ( snpdev->path );
|
||||
|
@ -1903,12 +1903,12 @@ static void efi_snp_remove ( struct net_device *netdev ) {
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( snpdev, "SNPDEV %p could not uninstall: %s\n",
|
||||
snpdev, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_snp ( &snpdev->snp );
|
||||
efi_nullify_nii ( &snpdev->nii );
|
||||
efi_nullify_name2 ( &snpdev->name2 );
|
||||
efi_nullify_load_file ( &snpdev->load_file );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_snp ( &snpdev->snp );
|
||||
efi_nullify_nii ( &snpdev->nii );
|
||||
efi_nullify_name2 ( &snpdev->name2 );
|
||||
efi_nullify_load_file ( &snpdev->load_file );
|
||||
if ( ! leak )
|
||||
free ( snpdev->path );
|
||||
bs->CloseEvent ( snpdev->snp.WaitForPacket );
|
||||
|
|
|
@ -759,9 +759,9 @@ int efi_snp_hii_install ( struct efi_snp_device *snpdev ) {
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( snpdev, "SNPDEV %p could not uninstall HII protocol: "
|
||||
"%s\n", snpdev, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_hii ( &snpdev->hii );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_hii ( &snpdev->hii );
|
||||
err_install_protocol:
|
||||
if ( ! leak )
|
||||
efihii->RemovePackageList ( efihii, snpdev->hii_handle );
|
||||
|
@ -812,9 +812,9 @@ int efi_snp_hii_uninstall ( struct efi_snp_device *snpdev ) {
|
|||
NULL ) ) != 0 ) {
|
||||
DBGC ( snpdev, "SNPDEV %p could not uninstall HII protocol: "
|
||||
"%s\n", snpdev, strerror ( -EEFI ( efirc ) ) );
|
||||
efi_nullify_hii ( &snpdev->hii );
|
||||
leak = 1;
|
||||
}
|
||||
efi_nullify_hii ( &snpdev->hii );
|
||||
if ( ! leak )
|
||||
efihii->RemovePackageList ( efihii, snpdev->hii_handle );
|
||||
if ( ( efirc = bs->UninstallMultipleProtocolInterfaces (
|
||||
|
|
Loading…
Reference in New Issue