Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185098
b: refs/heads/master
c: d54423c
h: refs/heads/master
v: v3
  • Loading branch information
Stefan Richter committed Feb 24, 2010
1 parent 929a48d commit 5fe633c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 109d28152b6e9d5de64cd23e3bc08885ccb3d1ef
refs/heads/master: d54423c62c2f687919d4e5bdd4bb064234ff2d44
32 changes: 22 additions & 10 deletions trunk/drivers/firewire/core-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <linux/bug.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/device.h>
Expand Down Expand Up @@ -580,11 +581,7 @@ static int read_bus_info_block(struct fw_device *device, int generation)
*/
key = stack[--sp];
i = key & 0xffffff;
if (i >= READ_BIB_ROM_SIZE)
/*
* The reference points outside the standard
* config rom area, something's fishy.
*/
if (WARN_ON(i >= READ_BIB_ROM_SIZE))
goto out;

/* Read header quadlet for the block to get the length. */
Expand All @@ -606,14 +603,29 @@ static int read_bus_info_block(struct fw_device *device, int generation)
* block, check the entries as we read them to see if
* it references another block, and push it in that case.
*/
while (i < end) {
for (; i < end; i++) {
if (read_rom(device, generation, i, &rom[i]) !=
RCODE_COMPLETE)
goto out;
if ((key >> 30) == 3 && (rom[i] >> 30) > 1 &&
sp < READ_BIB_STACK_SIZE)
stack[sp++] = i + rom[i];
i++;

if ((key >> 30) != 3 || (rom[i] >> 30) < 2 ||
sp >= READ_BIB_STACK_SIZE)
continue;
/*
* Offset points outside the ROM. May be a firmware
* bug or an Extended ROM entry (IEEE 1212-2001 clause
* 7.7.18). Simply overwrite this pointer here by a
* fake immediate entry so that later iterators over
* the ROM don't have to check offsets all the time.
*/
if (i + (rom[i] & 0xffffff) >= READ_BIB_ROM_SIZE) {
fw_error("skipped unsupported ROM entry %x at %llx\n",
rom[i],
i * 4 | CSR_REGISTER_BASE | CSR_CONFIG_ROM);
rom[i] = 0;
continue;
}
stack[sp++] = i + rom[i];
}
if (length < i)
length = i;
Expand Down

0 comments on commit 5fe633c

Please sign in to comment.