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:26:44 +0000 (11:26 +0200)
commit0450a50c914e165958bb6b12fcf4b68187f95f20
tree88395bd9f1527d3b0f71a612979a3c69896b65ad
parent774cc7c882f8b58ff295ebdec134284f93a76acb
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