X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fieee1394%2Fcsr1212.c;h=c28f639823d238c187f31daca9552f88c6ec188b;hb=93bbad8fe13a25dcf7f3bc628a71d1a7642ae61b;hp=586f71e7346a5e7d8fcfbbcb06a4bac543cf7124;hpb=af57d238aa2107e1b45d8dacad6e50db938f0567;p=powerpc.git diff --git a/drivers/ieee1394/csr1212.c b/drivers/ieee1394/csr1212.c index 586f71e734..c28f639823 100644 --- a/drivers/ieee1394/csr1212.c +++ b/drivers/ieee1394/csr1212.c @@ -47,14 +47,14 @@ #define __D (1 << CSR1212_KV_TYPE_DIRECTORY) #define __L (1 << CSR1212_KV_TYPE_LEAF) static const u_int8_t csr1212_key_id_type_map[0x30] = { - 0, /* Reserved */ + __C, /* used by Apple iSight */ __D | __L, /* Descriptor */ __I | __D | __L, /* Bus_Dependent_Info */ __I | __D | __L, /* Vendor */ __I, /* Hardware_Version */ 0, 0, /* Reserved */ - __D | __L, /* Module */ - 0, 0, 0, 0, /* Reserved */ + __D | __L | __I, /* Module */ + __I, 0, 0, 0, /* used by Apple iSight, Reserved */ __I, /* Node_Capabilities */ __L, /* EUI_64 */ 0, 0, 0, /* Reserved */ @@ -1234,6 +1234,12 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) csr->private); if (ret != CSR1212_SUCCESS) return ret; + + /* check ROM header's info_length */ + if (i == 0 && + CSR1212_BE32_TO_CPU(csr->cache_head->data[0]) >> 24 != + bytes_to_quads(csr->bus_info_len) - 1) + return CSR1212_EINVAL; } bi = (struct csr1212_bus_info_block_img*)csr->cache_head->data; @@ -1250,9 +1256,6 @@ static int csr1212_parse_bus_info_block(struct csr1212_csr *csr) return ret; } - if (bytes_to_quads(csr->bus_info_len - sizeof(csr1212_quad_t)) != bi->length) - return CSR1212_EINVAL; - #if 0 /* Apparently there are too many differnt wrong implementations of the * CRC algorithm that verifying them is moot. */