Re: [PATCH 1/2] EDAC/sysfs: Fix memory leak when creating a csrow object

From: Greg KH
Date: Wed May 08 2019 - 08:46:17 EST


On Wed, May 08, 2019 at 01:02:50PM +0200, Borislav Petkov wrote:
> >From 28e7f23939208bea639d6cd3d492cde3f65a7e4f Mon Sep 17 00:00:00 2001
> From: Pan Bian <bianpan2016@xxxxxxx>
> Date: Thu, 18 Apr 2019 10:27:18 +0800
>
> In edac_create_csrow_object(), the reference to the object is not
> released when adding the device to the device hierarchy fails
> (device_add()). This may result in a memory leak.
>
> Signed-off-by: Pan Bian <bianpan2016@xxxxxxx>
> Signed-off-by: Borislav Petkov <bp@xxxxxxx>
> Cc: Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: James Morse <james.morse@xxxxxxx>
> Cc: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>
> Cc: linux-edac <linux-edac@xxxxxxxxxxxxxxx>
> Link: https://lkml.kernel.org/r/1555554438-103953-1-git-send-email-bianpan2016@xxxxxxx
> ---
> drivers/edac/edac_mc_sysfs.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>