Patch "Drivers: hv: vmbus: Call hv_synic_free() if hv_synic_alloc() fails" has been added to the 6.3-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

    Drivers: hv: vmbus: Call hv_synic_free() if hv_synic_alloc() fails

to the 6.3-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:
     drivers-hv-vmbus-call-hv_synic_free-if-hv_synic_alloc-fails.patch
and it can be found in the queue-6.3 subdirectory.

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


>From ec97e112985c2581ee61854a4b74f080f6cdfc2c Mon Sep 17 00:00:00 2001
From: Dexuan Cui <decui@xxxxxxxxxxxxx>
Date: Thu, 4 May 2023 15:41:55 -0700
Subject: Drivers: hv: vmbus: Call hv_synic_free() if hv_synic_alloc() fails

From: Dexuan Cui <decui@xxxxxxxxxxxxx>

commit ec97e112985c2581ee61854a4b74f080f6cdfc2c upstream.

Commit 572086325ce9 ("Drivers: hv: vmbus: Cleanup synic memory free path")
says "Any memory allocations that succeeded will be freed when the caller
cleans up by calling hv_synic_free()", but if the get_zeroed_page() in
hv_synic_alloc() fails, currently hv_synic_free() is not really called
in vmbus_bus_init(), consequently there will be a memory leak, e.g.
hv_context.hv_numa_map is not freed in the error path. Fix this by
updating the goto labels.

Cc: stable@xxxxxxxxxx
Signed-off-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
Fixes: 4df4cb9e99f8 ("x86/hyperv: Initialize clockevents earlier in CPU onlining")
Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/20230504224155.10484-1-decui@xxxxxxxxxxxxx
Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/hv/vmbus_drv.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1525,7 +1525,7 @@ static int vmbus_bus_init(void)
 	ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "hyperv/vmbus:online",
 				hv_synic_init, hv_synic_cleanup);
 	if (ret < 0)
-		goto err_cpuhp;
+		goto err_alloc;
 	hyperv_cpuhp_online = ret;
 
 	ret = vmbus_connect();
@@ -1577,9 +1577,8 @@ static int vmbus_bus_init(void)
 
 err_connect:
 	cpuhp_remove_state(hyperv_cpuhp_online);
-err_cpuhp:
-	hv_synic_free();
 err_alloc:
+	hv_synic_free();
 	if (vmbus_irq == -1) {
 		hv_remove_vmbus_handler();
 	} else {


Patches currently in stable-queue which might be from decui@xxxxxxxxxxxxx are

queue-6.3/pci-hv-add-a-per-bus-mutex-state_lock.patch
queue-6.3/pci-hv-fix-a-race-condition-in-hv_irq_unmask-that-can-cause-panic.patch
queue-6.3/revert-pci-hv-fix-a-timing-issue-which-causes-kdump-to-fail-occasionally.patch
queue-6.3/pci-hv-remove-the-useless-hv_pcichild_state-from-struct-hv_pci_dev.patch
queue-6.3/drivers-hv-vmbus-call-hv_synic_free-if-hv_synic_alloc-fails.patch
queue-6.3/pci-hv-fix-a-race-condition-bug-in-hv_pci_query_relations.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