mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
via-ircc: don't return zero if via_ircc_open() failed
If via_ircc_open() fails, data structures of the driver left uninitialized, but probe (via_init_one()) returns zero. That can lead to null pointer dereference in via_remove_one(), since it does not check drvdata for NULL. The patch implements proper error code propagation. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e5733321d5
commit
18ebe5c1c6
1 changed files with 2 additions and 4 deletions
|
@ -210,8 +210,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
|
||||||
pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
|
pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
|
||||||
pci_write_config_byte(pcidev,0x5a,0xc0);
|
pci_write_config_byte(pcidev,0x5a,0xc0);
|
||||||
WriteLPCReg(0x28, 0x70 );
|
WriteLPCReg(0x28, 0x70 );
|
||||||
if (via_ircc_open(pcidev, &info, 0x3076) == 0)
|
rc = via_ircc_open(pcidev, &info, 0x3076);
|
||||||
rc=0;
|
|
||||||
} else
|
} else
|
||||||
rc = -ENODEV; //IR not turn on
|
rc = -ENODEV; //IR not turn on
|
||||||
} else { //Not VT1211
|
} else { //Not VT1211
|
||||||
|
@ -249,8 +248,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
|
||||||
info.irq=FirIRQ;
|
info.irq=FirIRQ;
|
||||||
info.dma=FirDRQ1;
|
info.dma=FirDRQ1;
|
||||||
info.dma2=FirDRQ0;
|
info.dma2=FirDRQ0;
|
||||||
if (via_ircc_open(pcidev, &info, 0x3096) == 0)
|
rc = via_ircc_open(pcidev, &info, 0x3096);
|
||||||
rc=0;
|
|
||||||
} else
|
} else
|
||||||
rc = -ENODEV; //IR not turn on !!!!!
|
rc = -ENODEV; //IR not turn on !!!!!
|
||||||
}//Not VT1211
|
}//Not VT1211
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue