diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-06-16 16:35:32 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-06-16 16:48:09 -0400 |
commit | 00635b8ee2b5650fd01f5602ecfa289db336b570 (patch) | |
tree | cac06b270ad4ad7f4171c3b47206ebb9bb035428 /drivers/firewire/net.c | |
parent | b01b4babbf204443b5a846a7494546501614cefc (diff) |
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>
Diffstat (limited to 'drivers/firewire/net.c')
-rw-r--r-- | drivers/firewire/net.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c index 47dcb45d720e..a42209a73aed 100644 --- a/drivers/firewire/net.c +++ b/drivers/firewire/net.c | |||
@@ -810,29 +810,27 @@ static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r, | |||
810 | int speed, unsigned long long offset, void *payload, | 810 | int speed, unsigned long long offset, void *payload, |
811 | size_t length, void *callback_data) | 811 | size_t length, void *callback_data) |
812 | { | 812 | { |
813 | struct fwnet_device *dev; | 813 | struct fwnet_device *dev = callback_data; |
814 | int status; | 814 | int rcode; |
815 | 815 | ||
816 | dev = callback_data; | 816 | if (destination == IEEE1394_ALL_NODES) { |
817 | if (tcode != TCODE_WRITE_BLOCK_REQUEST | 817 | kfree(r); |
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); | ||
822 | 818 | ||
823 | return; | 819 | return; |
824 | } | 820 | } |
825 | 821 | ||
826 | status = fwnet_incoming_packet(dev, payload, length, | 822 | if (offset != dev->handler.offset) |
827 | source, generation, false); | 823 | rcode = RCODE_ADDRESS_ERROR; |
828 | if (status != 0) { | 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 | fw_error("Incoming packet failure\n"); | 828 | fw_error("Incoming packet failure\n"); |
830 | fw_send_response(card, r, RCODE_CONFLICT_ERROR); | 829 | rcode = RCODE_CONFLICT_ERROR; |
831 | 830 | } else | |
832 | return; | 831 | rcode = RCODE_COMPLETE; |
833 | } | ||
834 | 832 | ||
835 | fw_send_response(card, r, RCODE_COMPLETE); | 833 | fw_send_response(card, r, rcode); |
836 | } | 834 | } |
837 | 835 | ||
838 | static void fwnet_receive_broadcast(struct fw_iso_context *context, | 836 | static void fwnet_receive_broadcast(struct fw_iso_context *context, |