Skip to content

Commit

Permalink
ssb: fix NULL ptr deref when pcihost_wrapper is used
Browse files Browse the repository at this point in the history
Ethernet driver b44 does register ssb by it's pcihost_wrapper
and doesn't set ssb_chipcommon. A check on this value
introduced with commit d53cdbb
and ea2db49 triggers:

BUG: unable to handle kernel NULL pointer dereference at 00000010
IP: [<c1266c36>] ssb_is_sprom_available+0x16/0x30

Signed-off-by: Christoph Fritz <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
ch-f authored and linvjw committed May 28, 2010
1 parent 368a07d commit da1fdb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/ssb/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,12 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
ssb_printk(KERN_ERR PFX "No SPROM available!\n");
return -ENODEV;
}

bus->sprom_offset = (bus->chipco.dev->id.revision < 31) ?
SSB_SPROM_BASE1 : SSB_SPROM_BASE31;
if (bus->chipco.dev) { /* can be unavailible! */
bus->sprom_offset = (bus->chipco.dev->id.revision < 31) ?
SSB_SPROM_BASE1 : SSB_SPROM_BASE31;
} else {
bus->sprom_offset = SSB_SPROM_BASE1;
}

buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
if (!buf)
Expand Down
1 change: 1 addition & 0 deletions drivers/ssb/sprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ bool ssb_is_sprom_available(struct ssb_bus *bus)
/* this routine differs from specs as we do not access SPROM directly
on PCMCIA */
if (bus->bustype == SSB_BUSTYPE_PCI &&
bus->chipco.dev && /* can be unavailible! */
bus->chipco.dev->id.revision >= 31)
return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM;

Expand Down

0 comments on commit da1fdb0

Please sign in to comment.