powerpc/pseries: fix memory leak in queue_hotplug_event() error path
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Mon, 19 Sep 2016 06:41:32 +0000 (16:41 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 20 Sep 2016 06:17:54 +0000 (16:17 +1000)
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 <andrew.donnellan@au1.ibm.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/pseries/dlpar.c

index 2511ccf186af5e8109e869e647f927ede8c8cbfa..423e450efe07cbf9d442f039f7148337251f561b 100644 (file)
@@ -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);
        }
 }