Skip to content

Commit 18ebe5c

Browse files
khoroshilovdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e573332 commit 18ebe5c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/net/irda/via-ircc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
210210
pci_write_config_byte(pcidev,0x42,(bTmp | 0xf0));
211211
pci_write_config_byte(pcidev,0x5a,0xc0);
212212
WriteLPCReg(0x28, 0x70 );
213-
if (via_ircc_open(pcidev, &info, 0x3076) == 0)
214-
rc=0;
213+
rc = via_ircc_open(pcidev, &info, 0x3076);
215214
} else
216215
rc = -ENODEV; //IR not turn on
217216
} else { //Not VT1211
@@ -249,8 +248,7 @@ static int via_init_one(struct pci_dev *pcidev, const struct pci_device_id *id)
249248
info.irq=FirIRQ;
250249
info.dma=FirDRQ1;
251250
info.dma2=FirDRQ0;
252-
if (via_ircc_open(pcidev, &info, 0x3096) == 0)
253-
rc=0;
251+
rc = via_ircc_open(pcidev, &info, 0x3096);
254252
} else
255253
rc = -ENODEV; //IR not turn on !!!!!
256254
}//Not VT1211

0 commit comments

Comments
 (0)