scsi: target: Fix xcopy sess release leak
authorMike Christie <michael.christie@oracle.com>
Thu, 2 Jul 2020 01:43:18 +0000 (20:43 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Sep 2020 09:29:18 +0000 (11:29 +0200)
commitcca4669a976868962fb8ae096c35633810bab328
tree8caf262f831bc09d17b37115dd7cb1a0d4100941
parentbce0f660a06ad2e25b14a18a17bbe6ef0af6f79d
scsi: target: Fix xcopy sess release leak

[ Upstream commit 3c006c7d23aac928279f7cbe83bbac4361255d53 ]

transport_init_session can allocate memory via percpu_ref_init, and
target_xcopy_release_pt never frees it. This adds a
transport_uninit_session function to handle cleanup of resources allocated
in the init function.

Link: https://lore.kernel.org/r/1593654203-12442-3-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/target/target_core_internal.h
drivers/target/target_core_transport.c
drivers/target/target_core_xcopy.c