From patchwork Tue Nov 22 12:35:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 2048 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2178376wrr; Tue, 22 Nov 2022 04:46:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf7cKxdqqhzplfhRUm2vYkstsJGgXnEx0TvCXIHjDArwg76/zYne3RRHH3MslImAil/+dBKm X-Received: by 2002:a17:907:7f9f:b0:7b2:a48e:302f with SMTP id qk31-20020a1709077f9f00b007b2a48e302fmr18046713ejc.334.1669121202936; Tue, 22 Nov 2022 04:46:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669121202; cv=none; d=google.com; s=arc-20160816; b=GIpdfwpHnsCVtDJyef2PQPwOnsUGowTXivbxAjCkVMgSE7uJSClLjbaGBQJzXJZ/4H iNpgmyfsSWhkgK2aozLF2LtRDYsXsFP5c+jpy74ajZsXiGJ0hsaGt+R0fiTdV937siYY fiQsYNoqxvhn2oMaAm0XbQvakdYf3k9zmoV9TkIZBAlj7CbrA/efZ0cFks6O5nlGheAv QS/RwLbCivVmOzAdaJ9wQtldciDntFEM8dUDeh8okSPRdLSvHCemhLzGOPysyXnRLUd5 3Dz3hINFyBHhDleGtQHHEZYMzhsnwzMUwMeCoGacVFKpKXhCoBSYK6r3Auc50SvWsWfU u67Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=WNYH3Wf/F/BKreKTbCqzjC+1rMIGWdBr2obALWP6rRQ=; b=kqnnRgZ00qJRcWRFCZrhdXWgcVF0nrLxJzZkBMaqUKp0XrowmqYCl2MjSbLutQb+TR xmouHtQmTq1PFgYF2929NOAA5uBJr+2r7G0ajEDdoyV2CPXYxAtAd/HebFxbO+2y0jvD BDAjRv2GbHbmIx1n6buIyMn2Ft1r5jpzrYEw78rvor1ew/CFMREcLHQFt+CrOjBjLDOJ s54Q9AGJEWF7RBZzqttg8qLs9UpfOnBwFIih7PluMo7Weux8Fa2xhRXooCOA0mVchNLl r9d1m5nfpDvNuctsJynvkemg1d86HSg8YVdeJYoj0F24u7JEm9+C3gLHndCkLYllFm5c BOLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=I3l1MCey; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 17-20020a170906059100b0078df19995e4si9372458ejn.241.2022.11.22.04.46.18; Tue, 22 Nov 2022 04:46:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@metanate.com header.s=stronger header.b=I3l1MCey; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=metanate.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233794AbiKVMfx (ORCPT + 99 others); Tue, 22 Nov 2022 07:35:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233548AbiKVMff (ORCPT ); Tue, 22 Nov 2022 07:35:35 -0500 Received: from metanate.com (unknown [IPv6:2001:8b0:1628:5005::111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 100005B84D; Tue, 22 Nov 2022 04:35:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Message-Id:Date: Subject:Cc:To:From:Content-Type:Reply-To:Content-ID:Content-Description: In-Reply-To:References; bh=WNYH3Wf/F/BKreKTbCqzjC+1rMIGWdBr2obALWP6rRQ=; b=I3 l1MCey4cfOQh+0NOa3qTF3QQOFG2nOJTicoX3Cv3gNypyyp+Y6gyj3q3t4bRpvGmpgdTJx2wEeKtb Xk0JRyrfAovyVyrXGF/gCe8q4FTqE1v17FarMyTJSKRkDC+wFvgKjxjkak3V6lSFd7L+YJRZjS67w CQXBlaM+a+u41s+5Dz74af2ZHoujuCgJXCdLCYre8doyidrj/3kTOou/r0j+KIk9a5dLu/xqWKYKJ j9uXC2S2e8lrwJnaCkHcD3fc1FMJhv/4Kn9aKC73qTAK9WgQ1XsiT+o6twaJeugyM1u2kGTyBilaP 2sK6jXcWtM624XmFbtoe1e86y7CT3Y2A==; Received: from [81.174.171.191] (helo=donbot.metanate.com) by email.metanate.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oxSUs-0003da-TD; Tue, 22 Nov 2022 12:35:31 +0000 From: John Keeping To: linux-usb@vger.kernel.org Cc: Fabien Chouteau , Peter Korsgaard , Felipe Balbi , Andrzej Pietrasiewicz , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , John Keeping , Lee Jones , Alan Stern Subject: [PATCH 0/3] usb: gadget: f_hid: fix f_hidg lifetime vs cdev Date: Tue, 22 Nov 2022 12:35:20 +0000 Message-Id: <20221122123523.3068034-1-john@metanate.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Authenticated: YES X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RDNS_NONE,SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750200373577334611?= X-GMAIL-MSGID: =?utf-8?q?1750200434422634361?= This series arises from the recent thread [1] on lifetime issues. The main point is the first patch, with the second being an unrelated fix for an issue spotted while working on this. Both of these have Fixes: tags for backporting to stable. The final patch tidies up some error handling to hopefully avoid patch 2 issues in the future. [1] https://lore.kernel.org/r/20221117120813.1257583-1-lee@kernel.org John Keeping (3): usb: gadget: f_hid: fix f_hidg lifetime vs cdev usb: gadget: f_hid: fix refcount leak on error path usb: gadget: f_hid: tidy error handling in hidg_alloc drivers/usb/gadget/function/f_hid.c | 60 ++++++++++++++++------------- 1 file changed, 33 insertions(+), 27 deletions(-) Reviewed-by: Lee Jones Tested-by: Lee Jones