tcm_usb_gadget: Fix nexus leak
authorNicholas Bellinger <nab@linux-iscsi.org>
Fri, 11 Dec 2015 15:06:14 +0000 (16:06 +0100)
committerNicholas Bellinger <nab@linux-iscsi.org>
Mon, 21 Dec 2015 03:40:19 +0000 (19:40 -0800)
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: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com>
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/usb/gadget/legacy/tcm_usb_gadget.c

index edc74d347d9876e212e1cba13c8730549a3d225e..e90d3c917e0b35d3aa13afc492e7b7fcc9bf2f14 100644 (file)
@@ -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);