| To: | Ralf Baechle <ralf@linux-mips.org> |
|---|---|
| Subject: | [PATCH] pci_alloc_consistent() crash |
| From: | Geert Uytterhoeven <geert@linux-m68k.org> |
| Date: | Fri, 23 May 2003 15:51:00 +0200 (MEST) |
| Cc: | Linux/MIPS Development <linux-mips@linux-mips.org> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| Sender: | linux-mips-bounce@linux-mips.org |
Hi Ralf,
Avoid a NULL-pointer dereference when using pci_alloc_consistent() for PCI-like
buses (i.e. hwdev = NULL).
--- linux-mips-2.4.x/arch/mips/kernel/pci-dma.c Tue Apr 1 16:21:18 2003
+++ linux/arch/mips/kernel/pci-dma.c Thu May 15 18:17:35 2003
@@ -21,6 +21,7 @@
{
void *ret;
int gfp = GFP_ATOMIC;
+ struct pci_bus *bus = NULL;
#ifdef CONFIG_ISA
if (hwdev == NULL || hwdev->dma_mask != 0xffffffff)
@@ -30,7 +31,9 @@
if (ret != NULL) {
memset(ret, 0, size);
- *dma_handle = bus_to_baddr(hwdev->bus, __pa(ret));
+ if (hwdev)
+ bus = hwdev->bus;
+ *dma_handle = bus_to_baddr(bus, __pa(ret));
#ifdef CONFIG_NONCOHERENT_IO
dma_cache_wback_inv((unsigned long) ret, size);
ret = UNCAC_ADDR(ret);
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH] Arrow keys on USB keyboards, Geert Uytterhoeven |
|---|---|
| Next by Date: | [PATCH] Embedded ramdisks, Geert Uytterhoeven |
| Previous by Thread: | [PATCH] Arrow keys on USB keyboards, Geert Uytterhoeven |
| Next by Thread: | Re: [PATCH] pci_alloc_consistent() crash, Ralf Baechle |
| Indexes: | [Date] [Thread] [Top] [All Lists] |