EDAC/sysfs: Fix memory leak when creating a csrow object
authorPan Bian <bianpan2016@163.com>
Thu, 18 Apr 2019 02:27:18 +0000 (10:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:26 +0000 (07:28 +0200)
commit7f669be3178401d63974ec913cab0fb131e80ab8
tree88da9cdcd452f84157a16b0083a527c2ad6204f1
parentca3445c2afc2898ffca97436306924d6fafefb53
EDAC/sysfs: Fix memory leak when creating a csrow object

[ Upstream commit 585fb3d93d32dbe89e718b85009f9c322cc554cd ]

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@163.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: James Morse <james.morse@arm.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: https://lkml.kernel.org/r/1555554438-103953-1-git-send-email-bianpan2016@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/edac/edac_mc_sysfs.c