From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8DDE234973 for ; Tue, 18 Feb 2025 11:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739879087; cv=none; b=MoT0YZFlI/kQ8oHjpDD/nMmkkLyFYDn5y97D4tZyxLqNNsbM9TDeL5Es6WrWjcIp5/PvGGw2Lc5nnrX5HXlE3rqjBVwQq+ccy03PEgXZHP2ndc86uxzO2W3gPaDbeI2JSx5JHfB2GhCa22dHiPBOKYVI4lwn/FrZrPKrgGOk0/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739879087; c=relaxed/simple; bh=6FJtR8tZ3p2kiRBQknZ+6eyRrtd7DhINUi3DmWcs1Ik=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=dhIKWIVUGpsQgZ6rYpDPTSNzUmoZsPwjjXIGGCjD8B71FnFV/gQs/CGHbtr3LW9tkHA3AWPYG5l7k9MbcitGmNscYFzVGp7LQy4TUxLJnzmJjHPC5H1fV0FHlKXhs2OoTsf0wPMtIZkWZEgyynfrIUTJRs0XhIIsjWMwOe8R3bw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FudnjPcL; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="FudnjPcL" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB9D3C4CEE2; Tue, 18 Feb 2025 11:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739879087; bh=6FJtR8tZ3p2kiRBQknZ+6eyRrtd7DhINUi3DmWcs1Ik=; h=Subject:To:Cc:From:Date:From; b=FudnjPcLDEGdad9Qu5jBcM4h1+eUwBmz6EJxtnqfbExgr/vtP+15HPkAK5aVRY6XY fEZljWTW/oz48e+KU/IcknClhaOK4O4D20mJRyOvWOJVhPCz2Dyf2KO6cJDRfl820N 1VkR+O69WqhREcm0RFyfHKga3bCQ2mOgHBF+tka4= Subject: FAILED: patch "[PATCH] usb: gadget: core: flush gadget workqueue after device" failed to apply to 6.1-stable tree To: royluo@google.com,Thinh.Nguyen@synopsys.com,gregkh@linuxfoundation.org,stable@kernel.org,stern@rowland.harvard.edu Cc: From: Date: Tue, 18 Feb 2025 12:44:42 +0100 Message-ID: <2025021842-eject-splendor-7c5d@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.1-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y git checkout FETCH_HEAD git cherry-pick -x 399a45e5237ca14037120b1b895bd38a3b4492ea # git commit -s git send-email --to '' --in-reply-to '2025021842-eject-splendor-7c5d@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 399a45e5237ca14037120b1b895bd38a3b4492ea Mon Sep 17 00:00:00 2001 From: Roy Luo Date: Tue, 4 Feb 2025 23:36:42 +0000 Subject: [PATCH] usb: gadget: core: flush gadget workqueue after device removal device_del() can lead to new work being scheduled in gadget->work workqueue. This is observed, for example, with the dwc3 driver with the following call stack: device_del() gadget_unbind_driver() usb_gadget_disconnect_locked() dwc3_gadget_pullup() dwc3_gadget_soft_disconnect() usb_gadget_set_state() schedule_work(&gadget->work) Move flush_work() after device_del() to ensure the workqueue is cleaned up. Fixes: 5702f75375aa9 ("usb: gadget: udc-core: move sysfs_notify() to a workqueue") Cc: stable Signed-off-by: Roy Luo Reviewed-by: Alan Stern Reviewed-by: Thinh Nguyen Link: https://lore.kernel.org/r/20250204233642.666991-1-royluo@google.com Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c index a6f46364be65..4b3d5075621a 100644 --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1543,8 +1543,8 @@ void usb_del_gadget(struct usb_gadget *gadget) kobject_uevent(&udc->dev.kobj, KOBJ_REMOVE); sysfs_remove_link(&udc->dev.kobj, "gadget"); - flush_work(&gadget->work); device_del(&gadget->dev); + flush_work(&gadget->work); ida_free(&gadget_id_numbers, gadget->id_number); cancel_work_sync(&udc->vbus_work); device_unregister(&udc->dev);