From: Andrew Donnellan Date: Mon, 19 Sep 2016 06:41:32 +0000 (+1000) Subject: powerpc/pseries: fix memory leak in queue_hotplug_event() error path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=90ce35145cb622b3cd0007d50e1f6a5a97321235;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git powerpc/pseries: fix memory leak in queue_hotplug_event() error path If we fail to allocate work, we don't end up using hp_errlog_copy. Free it in the error path. Signed-off-by: Andrew Donnellan Reviewed-by: Nathan Fontenot Signed-off-by: Michael Ellerman --- diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 2511ccf186af..423e450efe07 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c @@ -413,6 +413,7 @@ void queue_hotplug_event(struct pseries_hp_errorlog *hp_errlog, queue_work(pseries_hp_wq, (struct work_struct *)work); } else { *rc = -ENOMEM; + kfree(hp_errlog_copy); complete(hotplug_done); } }