]> www.infradead.org Git - users/dwmw2/linux.git/commit
infiniband: hfi1: fix memory leaks
authorWenwen Wang <wenwen@cs.uga.edu>
Sun, 18 Aug 2019 18:54:46 +0000 (13:54 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Sep 2019 09:35:22 +0000 (10:35 +0100)
commitdd53d830bb30fe1164e49a8c4677144fbd10940c
tree5e9ee711eb7e8ba11813bda31b572fb7b6ff2355
parentbcb3211656fa24090a828cc2ee13cf8f3b95f08d
infiniband: hfi1: fix memory leaks

[ Upstream commit 2323d7baab2b18d87d9bc267452e387aa9f0060a ]

In fault_opcodes_write(), 'data' is allocated through kcalloc(). However,
it is not deallocated in the following execution if an error occurs,
leading to memory leaks. To fix this issue, introduce the 'free_data' label
to free 'data' before returning the error.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Acked-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Link: https://lore.kernel.org/r/1566154486-3713-1-git-send-email-wenwen@cs.uga.edu
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hfi1/fault.c