lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 23 Sep 2022 17:25:30 +0800
From:   ruanjinjie <ruanjinjie@...wei.com>
To:     <gregkh@...uxfoundation.org>, <jirislaby@...nel.org>,
        <linux-kernel@...r.kernel.org>
CC:     <ruanjinjie@...wei.com>
Subject: [PATCH -next] tty: moxa: add missing pci_disable_device()

Driver should call pci_disable_device() if it returns from
moxa_pci_probe() with error.

Meanwhile, the driver calls pci_enable_device() in
moxa_pci_probe(), but never calls pci_disable_device() during removal.

Signed-off-by: ruanjinjie <ruanjinjie@...wei.com>
---
 drivers/tty/moxa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 35b6fddf0341..9174b64ea2db 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -1239,7 +1239,7 @@ static int moxa_pci_probe(struct pci_dev *pdev,
 	retval = pci_enable_device(pdev);
 	if (retval) {
 		dev_err(&pdev->dev, "can't enable pci device\n");
-		goto err;
+		return retval;
 	}
 
 	for (i = 0; i < MAX_BOARDS; i++)
@@ -1300,6 +1300,7 @@ static int moxa_pci_probe(struct pci_dev *pdev,
 err_reg:
 	pci_release_region(pdev, 2);
 err:
+	pci_disable_device(pdev);
 	return retval;
 }
 
@@ -1310,6 +1311,7 @@ static void moxa_pci_remove(struct pci_dev *pdev)
 	moxa_board_deinit(brd);
 
 	pci_release_region(pdev, 2);
+	pci_disable_device(pdev);
 }
 
 static struct pci_driver moxa_pci_driver = {
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ