Patch "net: pds_core: Fix possible double free in error handling path" has been added to the 6.6-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: pds_core: Fix possible double free in error handling path

to the 6.6-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-pds_core-fix-possible-double-free-in-error-handl.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 7e739a3be4bd1113f8062cbff439acbc7593d483
Author: Yongzhi Liu <hyperlyzcs@xxxxxxxxx>
Date:   Wed Mar 6 18:57:14 2024 +0800

    net: pds_core: Fix possible double free in error handling path
    
    [ Upstream commit ba18deddd6d502da71fd6b6143c53042271b82bd ]
    
    When auxiliary_device_add() returns error and then calls
    auxiliary_device_uninit(), Callback function pdsc_auxbus_dev_release
    calls kfree(padev) to free memory. We shouldn't call kfree(padev)
    again in the error handling path.
    
    Fix this by cleaning up the redundant kfree() and putting
    the error handling back to where the errors happened.
    
    Fixes: 4569cce43bc6 ("pds_core: add auxiliary_bus devices")
    Signed-off-by: Yongzhi Liu <hyperlyzcs@xxxxxxxxx>
    Reviewed-by: Wojciech Drewek <wojciech.drewek@xxxxxxxxx>
    Reviewed-by: Shannon Nelson <shannon.nelson@xxxxxxx>
    Link: https://lore.kernel.org/r/20240306105714.20597-1-hyperlyzcs@xxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/amd/pds_core/auxbus.c b/drivers/net/ethernet/amd/pds_core/auxbus.c
index 11c23a7f3172d..fd1a5149c0031 100644
--- a/drivers/net/ethernet/amd/pds_core/auxbus.c
+++ b/drivers/net/ethernet/amd/pds_core/auxbus.c
@@ -160,23 +160,19 @@ static struct pds_auxiliary_dev *pdsc_auxbus_dev_register(struct pdsc *cf,
 	if (err < 0) {
 		dev_warn(cf->dev, "auxiliary_device_init of %s failed: %pe\n",
 			 name, ERR_PTR(err));
-		goto err_out;
+		kfree(padev);
+		return ERR_PTR(err);
 	}
 
 	err = auxiliary_device_add(aux_dev);
 	if (err) {
 		dev_warn(cf->dev, "auxiliary_device_add of %s failed: %pe\n",
 			 name, ERR_PTR(err));
-		goto err_out_uninit;
+		auxiliary_device_uninit(aux_dev);
+		return ERR_PTR(err);
 	}
 
 	return padev;
-
-err_out_uninit:
-	auxiliary_device_uninit(aux_dev);
-err_out:
-	kfree(padev);
-	return ERR_PTR(err);
 }
 
 int pdsc_auxbus_dev_del(struct pdsc *cf, struct pdsc *pf)




[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