Patch "net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe" has been added to the 6.2-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe

to the 6.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-ethernet-ti-am65-cpsw-fix-mdio-cleanup-in-probe.patch
and it can be found in the queue-6.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3c5097ea3b2f5c871b5e8343c513bed562eb10ff
Author: Siddharth Vadapalli <s-vadapalli@xxxxxx>
Date:   Mon Apr 3 14:33:21 2023 +0530

    net: ethernet: ti: am65-cpsw: Fix mdio cleanup in probe
    
    [ Upstream commit c6b486fb33680ad5a3a6390ce693c835caaae3f7 ]
    
    In the am65_cpsw_nuss_probe() function's cleanup path, the call to
    of_platform_device_destroy() for the common->mdio_dev device is invoked
    unconditionally. It is possible that either the MDIO node is not present
    in the device-tree, or the MDIO node is disabled in the device-tree. In
    both these cases, the MDIO device is not created, resulting in a NULL
    pointer dereference when the of_platform_device_destroy() function is
    invoked on the common->mdio_dev device on the cleanup path.
    
    Fix this by ensuring that the common->mdio_dev device exists, before
    attempting to invoke of_platform_device_destroy().
    
    Fixes: a45cfcc69a25 ("net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio")
    Signed-off-by: Siddharth Vadapalli <s-vadapalli@xxxxxx>
    Reviewed-by: Roger Quadros <rogerq@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230403090321.835877-1-s-vadapalli@xxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 3e17152798554..9286b2b3353e3 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -2854,7 +2854,8 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
 	am65_cpsw_nuss_phylink_cleanup(common);
 	am65_cpts_release(common->cpts);
 err_of_clear:
-	of_platform_device_destroy(common->mdio_dev, NULL);
+	if (common->mdio_dev)
+		of_platform_device_destroy(common->mdio_dev, NULL);
 err_pm_clear:
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);
@@ -2883,7 +2884,8 @@ static int am65_cpsw_nuss_remove(struct platform_device *pdev)
 	am65_cpsw_nuss_phylink_cleanup(common);
 	am65_cpts_release(common->cpts);
 
-	of_platform_device_destroy(common->mdio_dev, NULL);
+	if (common->mdio_dev)
+		of_platform_device_destroy(common->mdio_dev, NULL);
 
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux