Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5814833rwb; Tue, 22 Nov 2022 05:23:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf584DXnVxzrCbGHrI7daZ6WLqK8ZDggz24uTm3iKw+pmc4wi9df3nk9WwAux/GRNAZqJZAM X-Received: by 2002:a17:906:6d48:b0:7ad:d408:3a2b with SMTP id a8-20020a1709066d4800b007add4083a2bmr19678569ejt.280.1669123392028; Tue, 22 Nov 2022 05:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669123392; cv=none; d=google.com; s=arc-20160816; b=IlOXdcVH95huF1eE3quyXoTVLpVmau3CVtTIaQTWDh3BtmzsWIbKWu/24iuWgCCgGd pSbmF7IXohTKndVp8+Mh/WVTXnklCYUbrYSXOStfZhBrqSwqdYac1KJE4nN6wAzUue/V cRjY2U87ebKNSAQ41PM+O36z4z8AfhZ5GeXz2xndeAiC/Qm0hrmIfNk8vvFJ10Z1JTyc lm/KfdcfImLEfwzM6JfVXiUiIEukgoefd/A35xxQAsTNO8LYflie5UTljIkMsTovps0J irtoLibAyO1WU1anssM4P7xTr+nxFJtVEqzUDT2/oDkgLb1m513ivb653jO/zFQcBIpv g3/g== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id st7-20020a170907c08700b007877b1c7f27si11036938ejc.829.2022.11.22.05.22.49; Tue, 22 Nov 2022 05:23:12 -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 + 90 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 Content-Transfer-Encoding: 8bit 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 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(-) -- 2.38.1