firewire: net: better FIFO address range check and rcodes

The AR req handler should not check the generation; higher level code
is the better place to handle bus generation changes. The target node
ID just needs to be checked for not being the "all nodes" address; in
this case don't handle the request and don't respond.

Use Address_Error and Type_Error rcodes as appropriate.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+14 -16
+14 -16
drivers/firewire/net.c
··· 810 810 int speed, unsigned long long offset, void *payload, 811 811 size_t length, void *callback_data) 812 812 { 813 - struct fwnet_device *dev; 814 - int status; 813 + struct fwnet_device *dev = callback_data; 814 + int rcode; 815 815 816 - dev = callback_data; 817 - if (tcode != TCODE_WRITE_BLOCK_REQUEST 818 - || destination != card->node_id /* <- FIXME */ 819 - || generation != card->generation /* <- FIXME */ 820 - || offset != dev->handler.offset) { 821 - fw_send_response(card, r, RCODE_CONFLICT_ERROR); 816 + if (destination == IEEE1394_ALL_NODES) { 817 + kfree(r); 822 818 823 819 return; 824 820 } 825 821 826 - status = fwnet_incoming_packet(dev, payload, length, 827 - source, generation, false); 828 - if (status != 0) { 822 + if (offset != dev->handler.offset) 823 + rcode = RCODE_ADDRESS_ERROR; 824 + else if (tcode != TCODE_WRITE_BLOCK_REQUEST) 825 + rcode = RCODE_TYPE_ERROR; 826 + else if (fwnet_incoming_packet(dev, payload, length, 827 + source, generation, false) != 0) { 829 828 fw_error("Incoming packet failure\n"); 830 - fw_send_response(card, r, RCODE_CONFLICT_ERROR); 829 + rcode = RCODE_CONFLICT_ERROR; 830 + } else 831 + rcode = RCODE_COMPLETE; 831 832 832 - return; 833 - } 834 - 835 - fw_send_response(card, r, RCODE_COMPLETE); 833 + fw_send_response(card, r, rcode); 836 834 } 837 835 838 836 static void fwnet_receive_broadcast(struct fw_iso_context *context,