From: Greg Kroah-Hartman Date: Wed, 28 Feb 2018 14:18:41 +0000 (+0100) Subject: 4.15-stable patches X-Git-Tag: v3.18.98~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ef1f95d0809171654925a9fee95a0771fbc576e5;p=thirdparty%2Fkernel%2Fstable-queue.git 4.15-stable patches added patches: ipmi_si-fix-error-handling-of-platform-device.patch --- diff --git a/queue-4.15/ipmi_si-fix-error-handling-of-platform-device.patch b/queue-4.15/ipmi_si-fix-error-handling-of-platform-device.patch new file mode 100644 index 00000000000..4e95b504c10 --- /dev/null +++ b/queue-4.15/ipmi_si-fix-error-handling-of-platform-device.patch @@ -0,0 +1,55 @@ +From 174134ac760275457bb0d1560a0dbe6cf8a12ad6 Mon Sep 17 00:00:00 2001 +From: Corey Minyard +Date: Mon, 27 Nov 2017 08:18:33 -0600 +Subject: ipmi_si: Fix error handling of platform device + +From: Corey Minyard + +commit 174134ac760275457bb0d1560a0dbe6cf8a12ad6 upstream. + +Cleanup of platform devices created by the IPMI driver was not +being done correctly and could result in a memory leak. So +create a local boolean to know how to clean up those platform +devices. + +Reported-by: David Binderman +Signed-off-by: Corey Minyard +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/char/ipmi/ipmi_si_intf.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/char/ipmi/ipmi_si_intf.c ++++ b/drivers/char/ipmi/ipmi_si_intf.c +@@ -2045,6 +2045,7 @@ static int try_smi_init(struct smi_info + int rv = 0; + int i; + char *init_name = NULL; ++ bool platform_device_registered = false; + + pr_info(PFX "Trying %s-specified %s state machine at %s address 0x%lx, slave address 0x%x, irq %d\n", + ipmi_addr_src_to_str(new_smi->io.addr_source), +@@ -2173,6 +2174,7 @@ static int try_smi_init(struct smi_info + rv); + goto out_err; + } ++ platform_device_registered = true; + } + + dev_set_drvdata(new_smi->io.dev, new_smi); +@@ -2279,10 +2281,11 @@ out_err: + } + + if (new_smi->pdev) { +- platform_device_unregister(new_smi->pdev); ++ if (platform_device_registered) ++ platform_device_unregister(new_smi->pdev); ++ else ++ platform_device_put(new_smi->pdev); + new_smi->pdev = NULL; +- } else if (new_smi->pdev) { +- platform_device_put(new_smi->pdev); + } + + kfree(init_name); diff --git a/queue-4.15/series b/queue-4.15/series index 09fcb2a96ac..a51ead27cb3 100644 --- a/queue-4.15/series +++ b/queue-4.15/series @@ -1,2 +1,3 @@ vsprintf-avoid-misleading-null-for-px.patch hrtimer-ensure-posix-compliance-relative-clock_realtime-hrtimers.patch +ipmi_si-fix-error-handling-of-platform-device.patch