소스 검색

[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 년 전
부모
커밋
308615cd97
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4
    1
      src/interface/efi/efi_snp.c

+ 4
- 1
src/interface/efi/efi_snp.c 파일 보기

@@ -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…
취소
저장