]> www.infradead.org Git - users/hch/misc.git/commitdiff
usb: gadget: f_tcm: Decrement command ref count on cleanup
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Wed, 11 Dec 2024 00:31:48 +0000 (00:31 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Dec 2024 07:56:06 +0000 (08:56 +0100)
We submitted the command with TARGET_SCF_ACK_KREF, which requires
acknowledgment of command completion. If the command fails, make sure to
decrement the ref count.

Fixes: cff834c16d23 ("usb-gadget/tcm: Convert to TARGET_SCF_ACK_KREF I/O krefs")
Cc: stable@vger.kernel.org
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/3c667b4d9c8b0b580346a69ff53616b6a74cfea2.1733876548.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/gadget/function/f_tcm.c

index 88b8b94fdb1e9754cd94309a8c1858635bdae7c5..5ce97723376eb47c6a354617f0f9f492c5fb8699 100644 (file)
@@ -969,6 +969,7 @@ static void usbg_data_write_cmpl(struct usb_ep *ep, struct usb_request *req)
        return;
 
 cleanup:
+       target_put_sess_cmd(se_cmd);
        transport_generic_free_cmd(&cmd->se_cmd, 0);
 }