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]
Message-ID: <1575009408-30362-1-git-send-email-fugang.duan@nxp.com>
Date:   Fri, 29 Nov 2019 06:40:28 +0000
From:   Andy Duan <fugang.duan@....com>
To:     "davem@...emloft.net" <davem@...emloft.net>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        Andy Duan <fugang.duan@....com>
Subject: [PATCH net,stable 1/1] net: fec: match the dev_id between probe and
 remove

Test device bind/unbind on i.MX8QM platform:
echo 5b040000.ethernet > /sys/bus/platform/drivers/fec/unbind
echo 5b040000.ethernet > /sys/bus/platform/drivers/fec/bind

error log:
pps pps0: new PPS source ptp0 /sys/bus/platform/drivers/fec/bind
fec: probe of 5b040000.ethernet failed with error -2

It should decrease the dev_id when device is unbinded. So let
the fec_dev_id as global variable and let the count match in
.probe() and .remvoe().

Reported-by: shivani.patel <shivani.patel@...ansystech.com>
Signed-off-by: Fugang Duan <fugang.duan@....com>
---
 drivers/net/ethernet/freescale/fec_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 05c1899..348fd8a 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -243,6 +243,7 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
 	(addr < txq->tso_hdrs_dma + txq->bd.ring_size * TSO_HEADER_SIZE))
 
 static int mii_cnt;
+static int fec_dev_id;
 
 static struct bufdesc *fec_enet_get_nextdesc(struct bufdesc *bdp,
 					     struct bufdesc_prop *bd)
@@ -3397,7 +3398,6 @@ fec_probe(struct platform_device *pdev)
 	struct net_device *ndev;
 	int i, irq, ret = 0;
 	const struct of_device_id *of_id;
-	static int dev_id;
 	struct device_node *np = pdev->dev.of_node, *phy_node;
 	int num_tx_qs;
 	int num_rx_qs;
@@ -3442,7 +3442,7 @@ fec_probe(struct platform_device *pdev)
 	}
 
 	fep->pdev = pdev;
-	fep->dev_id = dev_id++;
+	fep->dev_id = fec_dev_id++;
 
 	platform_set_drvdata(pdev, ndev);
 
@@ -3623,7 +3623,7 @@ fec_probe(struct platform_device *pdev)
 		of_phy_deregister_fixed_link(np);
 	of_node_put(phy_node);
 failed_phy:
-	dev_id--;
+	fec_dev_id--;
 failed_ioremap:
 	free_netdev(ndev);
 
@@ -3653,6 +3653,7 @@ fec_drv_remove(struct platform_device *pdev)
 		of_phy_deregister_fixed_link(np);
 	of_node_put(fep->phy_node);
 	free_netdev(ndev);
+	fec_dev_id--;
 
 	clk_disable_unprepare(fep->clk_ahb);
 	clk_disable_unprepare(fep->clk_ipg);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ