diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-03-19 16:40:32 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2008-04-18 11:55:33 -0400 |
commit | c8a9a498e16b2a6c0e4e367b1a01f80fdfd7b6e2 (patch) | |
tree | f8e7fdab0bc3eefc98d6c0a09ab02337b6090371 /drivers/firewire/fw-ohci.c | |
parent | 2ed0f181f0d18d2f565bfbd259fe33d53769f72b (diff) |
firewire: fw-ohci: add self ID error check
Discard self ID buffer contents if
- the selfIDError flag is set,
- any of the self ID packets has bit errors.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Jarod Wilson <jwilson@redhat.com>
Diffstat (limited to 'drivers/firewire/fw-ohci.c')
-rw-r--r-- | drivers/firewire/fw-ohci.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/firewire/fw-ohci.c b/drivers/firewire/fw-ohci.c index 92ff38f82d96..1f6f15f0dce2 100644 --- a/drivers/firewire/fw-ohci.c +++ b/drivers/firewire/fw-ohci.c | |||
@@ -1019,20 +1019,26 @@ static void bus_reset_tasklet(unsigned long data) | |||
1019 | ohci->node_id = reg & (OHCI1394_NodeID_busNumber | | 1019 | ohci->node_id = reg & (OHCI1394_NodeID_busNumber | |
1020 | OHCI1394_NodeID_nodeNumber); | 1020 | OHCI1394_NodeID_nodeNumber); |
1021 | 1021 | ||
1022 | reg = reg_read(ohci, OHCI1394_SelfIDCount); | ||
1023 | if (reg & OHCI1394_SelfIDCount_selfIDError) { | ||
1024 | fw_notify("inconsistent self IDs\n"); | ||
1025 | return; | ||
1026 | } | ||
1022 | /* | 1027 | /* |
1023 | * The count in the SelfIDCount register is the number of | 1028 | * The count in the SelfIDCount register is the number of |
1024 | * bytes in the self ID receive buffer. Since we also receive | 1029 | * bytes in the self ID receive buffer. Since we also receive |
1025 | * the inverted quadlets and a header quadlet, we shift one | 1030 | * the inverted quadlets and a header quadlet, we shift one |
1026 | * bit extra to get the actual number of self IDs. | 1031 | * bit extra to get the actual number of self IDs. |
1027 | */ | 1032 | */ |
1028 | 1033 | self_id_count = (reg >> 3) & 0x3ff; | |
1029 | self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff; | ||
1030 | generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; | 1034 | generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; |
1031 | rmb(); | 1035 | rmb(); |
1032 | 1036 | ||
1033 | for (i = 1, j = 0; j < self_id_count; i += 2, j++) { | 1037 | for (i = 1, j = 0; j < self_id_count; i += 2, j++) { |
1034 | if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) | 1038 | if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) { |
1035 | fw_error("inconsistent self IDs\n"); | 1039 | fw_notify("inconsistent self IDs\n"); |
1040 | return; | ||
1041 | } | ||
1036 | ohci->self_id_buffer[j] = | 1042 | ohci->self_id_buffer[j] = |
1037 | cond_le32_to_cpu(ohci->self_id_cpu[i]); | 1043 | cond_le32_to_cpu(ohci->self_id_cpu[i]); |
1038 | } | 1044 | } |