mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-22 15:47:37 +00:00
Fix panic in firewire and creation of invalid config ROM.
(This change was supposed to be included in r277508.) sys/boot/i386/libfirewire/firewire.c: Fix configuration ROM generation count wrapping logic so that the generation count is never outside of allowed limits (0x2 -> 0xF). Submitted by: gibbs MFC after: 1 week MFC with: 277508 Sponsored by: Spectra Logic MFSpectraBSD: 1110685 on 2015/01/05
This commit is contained in:
parent
27051ca14b
commit
fda4e21549
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=277622
@ -233,7 +233,8 @@ fw_init_crom(struct fwohci_softc *sc)
|
||||
src->businfo.cyc_clk_acc = 100;
|
||||
src->businfo.max_rec = sc->maxrec;
|
||||
src->businfo.max_rom = MAXROM_4;
|
||||
src->businfo.generation = 1;
|
||||
#define FW_GENERATION_CHANGEABLE 2
|
||||
src->businfo.generation = FW_GENERATION_CHANGEABLE;
|
||||
src->businfo.link_spd = sc->speed;
|
||||
|
||||
src->businfo.eui64.hi = sc->eui.hi;
|
||||
@ -313,11 +314,14 @@ fw_crom(struct fwohci_softc *sc)
|
||||
src = &sc->crom_src_buf->src;
|
||||
crom_load(src, (uint32_t *)newrom, CROMSIZE);
|
||||
if (bcmp(newrom, sc->config_rom, CROMSIZE) != 0) {
|
||||
/* bump generation and reload */
|
||||
src->businfo.generation ++;
|
||||
/* generation must be between 0x2 and 0xF */
|
||||
/* Bump generation and reload. */
|
||||
src->businfo.generation++;
|
||||
|
||||
/* Handle generation count wraps. */
|
||||
if (src->businfo.generation < 2)
|
||||
src->businfo.generation ++;
|
||||
src->businfo.generation = 2;
|
||||
|
||||
/* Recalculate CRC to account for generation change. */
|
||||
crom_load(src, (uint32_t *)newrom, CROMSIZE);
|
||||
bcopy(newrom, (void *)sc->config_rom, CROMSIZE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user