Commit f7b0d2df2f6fd9abdf47b4a1965dcaa2870e35df
1 parent
adcd33d41b
Exists in
master
and in
7 other branches
cs5530: add missing ->dma_base check
If ->dma_base is not set (== PCI BAR4 cannot be reserved) then DMA hooks shouldn't be initialized or bad things will happen. Also this host driver requires valid PCI BAR4 for normal operation so check it in ->init_chipset and fail initialization if not set. Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Showing 1 changed file with 7 additions and 1 deletions Side-by-side Diff
drivers/ide/pci/cs5530.c
1 | 1 | /* |
2 | - * linux/drivers/ide/pci/cs5530.c Version 0.73 Mar 10 2007 | |
2 | + * linux/drivers/ide/pci/cs5530.c Version 0.74 Jul 28 2007 | |
3 | 3 | * |
4 | 4 | * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org> |
5 | 5 | * Copyright (C) 2000 Mark Lord <mlord@pobox.com> |
... | ... | @@ -207,6 +207,9 @@ |
207 | 207 | struct pci_dev *master_0 = NULL, *cs5530_0 = NULL; |
208 | 208 | unsigned long flags; |
209 | 209 | |
210 | + if (pci_resource_start(dev, 4) == 0) | |
211 | + return -EFAULT; | |
212 | + | |
210 | 213 | dev = NULL; |
211 | 214 | while ((dev = pci_get_device(PCI_VENDOR_ID_CYRIX, PCI_ANY_ID, dev)) != NULL) { |
212 | 215 | switch (dev->device) { |
... | ... | @@ -324,6 +327,9 @@ |
324 | 327 | hwif->drives[1].autotune = 1; |
325 | 328 | /* needs autotuning later */ |
326 | 329 | } |
330 | + | |
331 | + if (hwif->dma_base == 0) | |
332 | + return; | |
327 | 333 | |
328 | 334 | hwif->atapi_dma = 1; |
329 | 335 | hwif->ultra_mask = 0x07; |