Parcourir la source

[efi] Always allow MAX_LL_HEADER_LEN for the link-layer header

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown il y a 14 ans
Parent
révision
308615cd97
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  1. 4
    1
      src/interface/efi/efi_snp.c

+ 4
- 1
src/interface/efi/efi_snp.c Voir le fichier

@@ -530,6 +530,7 @@ efi_snp_transmit ( EFI_SIMPLE_NETWORK_PROTOCOL *snp,
530 530
 		container_of ( snp, struct efi_snp_device, snp );
531 531
 	struct ll_protocol *ll_protocol = snpdev->netdev->ll_protocol;
532 532
 	struct io_buffer *iobuf;
533
+	size_t ll_headroom;
533 534
 	int rc;
534 535
 	EFI_STATUS efirc;
535 536
 
@@ -582,13 +583,15 @@ efi_snp_transmit ( EFI_SIMPLE_NETWORK_PROTOCOL *snp,
582 583
 	}
583 584
 
584 585
 	/* Allocate buffer */
585
-	iobuf = alloc_iob ( len );
586
+	ll_headroom = ( MAX_LL_HEADER_LEN - ll_header_len );
587
+	iobuf = alloc_iob ( ll_headroom + len );
586 588
 	if ( ! iobuf ) {
587 589
 		DBGC ( snpdev, "SNPDEV %p TX could not allocate %ld-byte "
588 590
 		       "buffer\n", snpdev, ( ( unsigned long ) len ) );
589 591
 		efirc = EFI_DEVICE_ERROR;
590 592
 		goto err_alloc_iob;
591 593
 	}
594
+	iob_reserve ( iobuf, ll_headroom );
592 595
 	memcpy ( iob_put ( iobuf, len ), data, len );
593 596
 
594 597
 	/* Create link-layer header, if specified */

Chargement…
Annuler
Enregistrer