Patch "parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries" has been added to the 5.10-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

    parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries

to the 5.10-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:
     parisc-pdc_stable-fix-memory-leak-in-pdcs_register_pathentries.patch
and it can be found in the queue-5.10 subdirectory.

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


>From d24846a4246b6e61ecbd036880a4adf61681d241 Mon Sep 17 00:00:00 2001
From: Miaoqian Lin <linmq006@xxxxxxxxx>
Date: Thu, 20 Jan 2022 12:18:12 +0000
Subject: parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

From: Miaoqian Lin <linmq006@xxxxxxxxx>

commit d24846a4246b6e61ecbd036880a4adf61681d241 upstream.

kobject_init_and_add() takes reference even when it fails.
According to the doc of kobject_init_and_add():

   If this function returns an error, kobject_put() must be called to
   properly clean up the memory associated with the object.

Fix memory leak by calling kobject_put().

Fixes: 73f368cf679b ("Kobject: change drivers/parisc/pdc_stable.c to use kobject_init_and_add")
Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>
Signed-off-by: Helge Deller <deller@xxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/parisc/pdc_stable.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- a/drivers/parisc/pdc_stable.c
+++ b/drivers/parisc/pdc_stable.c
@@ -979,8 +979,10 @@ pdcs_register_pathentries(void)
 		entry->kobj.kset = paths_kset;
 		err = kobject_init_and_add(&entry->kobj, &ktype_pdcspath, NULL,
 					   "%s", entry->name);
-		if (err)
+		if (err) {
+			kobject_put(&entry->kobj);
 			return err;
+		}
 
 		/* kobject is now registered */
 		write_lock(&entry->rw_lock);


Patches currently in stable-queue which might be from linmq006@xxxxxxxxx are

queue-5.10/usb-dwc3-qcom-fix-null-vs-is_err-checking-in-dwc3_qc.patch
queue-5.10/phy-mediatek-fix-missing-check-in-mtk_mipi_tx_probe.patch
queue-5.10/parisc-pdc_stable-fix-memory-leak-in-pdcs_register_pathentries.patch
queue-5.10/bluetooth-hci_qca-fix-null-vs-is_err_or_null-check-i.patch
queue-5.10/spi-spi-meson-spifc-add-missing-pm_runtime_disable-i.patch



[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