]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
test_firmware: fix a memory leak bug
authorWenwen Wang <wenwen@cs.uga.edu>
Sun, 14 Jul 2019 06:11:35 +0000 (01:11 -0500)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 17 Sep 2019 16:02:18 +0000 (18:02 +0200)
commit311b9b49ea900e94095506b4ff527e7f07db08e7
tree3c801c523e011045ceabbd1eaccd18f540c569fd
parent3e12c7957d7b125a597531cc34369f6c729369b8
test_firmware: fix a memory leak bug

BugLink: https://bugs.launchpad.net/bugs/1840520
[ Upstream commit d4fddac5a51c378c5d3e68658816c37132611e1f ]

In test_firmware_init(), the buffer pointed to by the global pointer
'test_fw_config' is allocated through kzalloc(). Then, the buffer is
initialized in __test_firmware_config_init(). In the case that the
initialization fails, the following execution in test_firmware_init() needs
to be terminated with an error code returned to indicate this failure.
However, the allocated buffer is not freed on this execution path, leading
to a memory leak bug.

To fix the above issue, free the allocated buffer before returning from
test_firmware_init().

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Link: https://lore.kernel.org/r/1563084696-6865-1-git-send-email-wang6495@umn.edu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
lib/test_firmware.c