Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4fef4e43 authored by Nicholas Bellinger's avatar Nicholas Bellinger
Browse files

tcm_usb_gadget: Fix nexus leak



This patch adds the missing tcm_usbg_drop_nexus() to properly
release tcm_usbg_nexus memory during typical ->fabric_drop_tpg()
callback shutdown.

Reported-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: default avatarAndrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent a0841d44
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1423,11 +1423,14 @@ static struct se_portal_group *usbg_make_tpg(
	return &tpg->se_tpg;
}

static int tcm_usbg_drop_nexus(struct usbg_tpg *);

static void usbg_drop_tpg(struct se_portal_group *se_tpg)
{
	struct usbg_tpg *tpg = container_of(se_tpg,
				struct usbg_tpg, se_tpg);

	tcm_usbg_drop_nexus(tpg);
	core_tpg_deregister(se_tpg);
	destroy_workqueue(tpg->workqueue);
	kfree(tpg);