Kaynağa Gözat

[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 14 yıl önce
ebeveyn
işleme
308615cd97
1 değiştirilmiş dosya ile 4 ekleme ve 1 silme
  1. 4
    1
      src/interface/efi/efi_snp.c

+ 4
- 1
src/interface/efi/efi_snp.c Dosyayı Görüntüle

@@ -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 */

Loading…
İptal
Kaydet