OSDN Git Service

EDAC, i7core: Fix memleaks and use-after-free on probe and remove
authorJohan Hovold <johan@kernel.org>
Tue, 12 Jun 2018 12:43:35 +0000 (14:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Oct 2018 00:01:48 +0000 (17:01 -0700)
commit64e5837e85c7984d192fd54b11c98ab091b5fa46
tree101a5b9bfdc60ede9b05c14991b80d0bebc65827
parent4fa0de88105f946619ffffb924fb254f925b0798
EDAC, i7core: Fix memleaks and use-after-free on probe and remove

[ Upstream commit 6c974d4dfafe5e9ee754f2a6fba0eb1864f1649e ]

Make sure to free and deregister the addrmatch and chancounts devices
allocated during probe in all error paths. Also fix use-after-free in a
probe error path and in the remove success path where the devices were
being put before before deregistration.

Signed-off-by: Johan Hovold <johan@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>
Fixes: 356f0a30860d ("i7core_edac: change the mem allocation scheme to make Documentation/kobject.txt happy")
Link: http://lkml.kernel.org/r/20180612124335.6420-2-johan@kernel.org
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/edac/i7core_edac.c