Commit 00635b8e authored by Stefan Richter's avatar Stefan Richter

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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent b01b4bab
...@@ -810,29 +810,27 @@ static void fwnet_receive_packet(struct fw_card *card, struct fw_request *r, ...@@ -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, int speed, unsigned long long offset, void *payload,
size_t length, void *callback_data) size_t length, void *callback_data)
{ {
struct fwnet_device *dev; struct fwnet_device *dev = callback_data;
int status; int rcode;
dev = callback_data; if (destination == IEEE1394_ALL_NODES) {
if (tcode != TCODE_WRITE_BLOCK_REQUEST kfree(r);
|| destination != card->node_id /* <- FIXME */
|| generation != card->generation /* <- FIXME */
|| offset != dev->handler.offset) {
fw_send_response(card, r, RCODE_CONFLICT_ERROR);
return; return;
} }
status = fwnet_incoming_packet(dev, payload, length, if (offset != dev->handler.offset)
source, generation, false); rcode = RCODE_ADDRESS_ERROR;
if (status != 0) { 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_error("Incoming packet failure\n");
fw_send_response(card, r, RCODE_CONFLICT_ERROR); rcode = RCODE_CONFLICT_ERROR;
} else
return; 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, static void fwnet_receive_broadcast(struct fw_iso_context *context,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment