diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-06-16 22:35:32 +0200 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-06-16 22:48:09 +0200 |
commit | 00635b8ee2b5650fd01f5602ecfa289db336b570 (patch) | |
tree | cac06b270ad4ad7f4171c3b47206ebb9bb035428 /drivers/firewire/net.c | |
parent | b01b4babbf204443b5a846a7494546501614cefc (diff) | |
download | linux-stable-00635b8ee2b5650fd01f5602ecfa289db336b570.tar.gz linux-stable-00635b8ee2b5650fd01f5602ecfa289db336b570.tar.bz2 linux-stable-00635b8ee2b5650fd01f5602ecfa289db336b570.zip |
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, int speed, unsigned long long offset, void *payload, size_t length, void *callback_data) { - struct fwnet_device *dev; - int status; + struct fwnet_device *dev = callback_data; + int rcode; - dev = callback_data; - if (tcode != TCODE_WRITE_BLOCK_REQUEST - || destination != card->node_id /* <- FIXME */ - || generation != card->generation /* <- FIXME */ - || offset != dev->handler.offset) { - fw_send_response(card, r, RCODE_CONFLICT_ERROR); + if (destination == IEEE1394_ALL_NODES) { + kfree(r); return; } - status = fwnet_incoming_packet(dev, payload, length, - source, generation, false); - if (status != 0) { + if (offset != dev->handler.offset) + rcode = RCODE_ADDRESS_ERROR; + else if (tcode != TCODE_WRITE_BLOCK_REQUEST) + rcode = RCODE_TYPE_ERROR; + else if (fwnet_incoming_packet(dev, payload, length, + source, generation, false) != 0) { fw_error("Incoming packet failure\n"); - fw_send_response(card, r, RCODE_CONFLICT_ERROR); - - return; - } + rcode = RCODE_CONFLICT_ERROR; + } else + rcode = RCODE_COMPLETE; - fw_send_response(card, r, RCODE_COMPLETE); + fw_send_response(card, r, rcode); } static void fwnet_receive_broadcast(struct fw_iso_context *context, |