Hi all, This is another patch from Avik Sil. Bellow are the bug explanation:
I found another grub bug in tftp transfer. The issue comes for a subtle corner case.
While grub sends tftp acks, it maintains a 'count' variable that is incremented on each data packet received from tftp server. On every data packet received, if 'count' is less than 50, it sends an ack, otherwise it wont. So for this '50'th packet the ack is sent by another function 'tftp_packets_pulled' that is called later from net read routine through a function pointer.
When the last block of a file is received as a data packet it is verified that it's the last block and the socket is closed.
Now there is a corner case. In case the last block happens to be that '50'th block the ack is not sent (as usual) and the socket is closed. Afterwards, when the net read routine calls 'tftp_packets_pulled' it tries to send the ack using that closed socket, resulting in failure in sending the ack packet! This happened to be the case for the vmlinuz file I'm trying to load.
The attached patch fixes this issue by checking if the ack packet is already sent before closing the packet; if not sent call the ack routine.
-- Paulo Flabiano Smorigo Software Engineer Linux Technology Center - IBM Systems & Technology Group
=== modified file 'ChangeLog' --- ChangeLog 2013-08-14 13:36:18 +0000 +++ ChangeLog 2013-08-14 13:38:05 +0000 @@ -1,5 +1,9 @@ 2013-08-14 Avik Sil <avik...@in.ibm.com> + * grub-core/net/tftp.c: Send tftp ack packet before closing the socket. + +2013-08-14 Avik Sil <avik...@in.ibm.com> + * grub-core/net/drivers/ieee1275/ofnet.c: Get proper mac address when using qemu. === modified file 'grub-core/net/tftp.c' --- grub-core/net/tftp.c 2012-07-02 09:22:50 +0000 +++ grub-core/net/tftp.c 2013-08-14 13:36:51 +0000 @@ -243,6 +243,8 @@ data->block++; if (size < data->block_size) { + if (data->ack_sent < data->block) + ack (data, data->block); file->device->net->eof = 1; file->device->net->stall = 1; grub_net_udp_close (data->sock);
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel