lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251030-auto-cleanup-v1-0-db30584fadfd@google.com>
Date: Thu, 30 Oct 2025 23:14:18 +0800
From: Kuen-Han Tsai <khtsai@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Thinh Nguyen <Thinh.Nguyen@...opsys.com>
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Kuen-Han Tsai <khtsai@...gle.com>
Subject: [PATCH 0/2] usb: gadget: Auto-cleanup usb_request in f_loopback, f_tcm

This series refactors f_loopback and f_tcm function drivers to use 
automatic, scope-based cleanup mechansim for usb_request objects.

Specific considerations in each driver:

  - In f_loopback.c, the shared buffer between in_req and out_req is
    handled by nullifying in_req->buf before returning on usb_ep_queue
    failure. This ensures the buffer is only freed once by the out_req
    cleanup.

  - In f_tcm.c, explicit nullification of request pointers in the f_uas
    structure on error is no longer necessary. The pointers are now only
    updated after all allocations within the respective functions 
    (bot_prepare_reqs, uasp_alloc_stream_res, uasp_alloc_cmd) succeed.
    Existing cleanup functions handle any stale pointers if an error
    occurs before the structure is updated.

Signed-off-by: Kuen-Han Tsai <khtsai@...gle.com>
---
Kuen-Han Tsai (2):
      usb: gadget: f_tcm: Use auto-cleanup for usb_request
      usb: gadget: f_loopback: Use auto-cleanup for usb_request

 drivers/usb/gadget/function/f_loopback.c |  30 +++----
 drivers/usb/gadget/function/f_tcm.c      | 141 +++++++++++++++----------------
 2 files changed, 80 insertions(+), 91 deletions(-)
---
base-commit: dcb6fa37fd7bc9c3d2b066329b0d27dedf8becaa
change-id: 20251029-auto-cleanup-e0240f2d7f2a

Best regards,
-- 
Kuen-Han Tsai <khtsai@...gle.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ