Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1860281rwb; Fri, 19 Aug 2022 10:35:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR6VUz042vyXztACSzHy/qwlAuFZlD7bSAzi9KxUhGzFFQe2RTHhmpZ+U4QjsaaAcWxP1dtR X-Received: by 2002:a17:902:e552:b0:16d:d3c0:85fb with SMTP id n18-20020a170902e55200b0016dd3c085fbmr8346439plf.38.1660930503060; Fri, 19 Aug 2022 10:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660930503; cv=none; d=google.com; s=arc-20160816; b=PfxcOWWLonlqlLYlmO90mViUY3KQE8QxkA+XDfWqGOWvrx2F1wmI3/xj8Y8nOAm1cY JnN67fGXVkFW4kiHTQ/beEfIemIQpvkvOGb1qZCvQx5s9y6NZtUTkBH0zgbNzwOlGgA6 s7lmuH9PLQ13r9vZw5MeFwjmzNUOBWFvPRdIC/j3Nc6yuKgFAamoGXOPZBiXsVpMydbA Ydg9qf+6pPGl6Bu68zIeithB3vRllU+VROo++QFcumxs3CZ6A9bnDw1OOjVJ+d6sUQMg SgWE0a7jhLOMBdsJl/HcQ3Anx72vC0p9k61NwXdmoLOQd2Hps1ro6Sn9Zh5x2a7UMBg1 Lfow== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ix4tlTM73NStMSghvz9TJ4Kd7We/XE9UPwIBOCjx7Kw=; b=llYRlgIA3iZlLXFcp5JBYpCXzW4rUugQB23C9kg/7Tm9+n2KoCb88GwRvWZBgBpuRC mhgcNT+bvnRrsdVsBR20p6RMLgW/k1vGfRAEmt1q7FsqPRowUJjgYPlBPQKzKAS3hm5W Bp3tFVuALAYFVofLurdH1pjEF23EamouNSfO6lu5tdRfDAJRix7IxvsixA70XLDs22V/ KsATPKNGdnZn9X+EFV6mCxoCeb9VQ9zJEvNZ7p0vFsGsI+kqckRE/Ij0JlQeKTwq4UzV pxYGYzlk5FM3cGq7tM+o+DKw84SZqB4ryeyWUjakg6iGFXa0qHdmGXpU+BE9mAkPt/Kq sz6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="zU/39ZsB"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 8-20020a17090a0a8800b001ec9e904597si4555360pjw.27.2022.08.19.10.34.51; Fri, 19 Aug 2022 10:35:03 -0700 (PDT) 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 header.i=@linuxfoundation.org header.s=korg header.b="zU/39ZsB"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352492AbiHSQVH (ORCPT + 99 others); Fri, 19 Aug 2022 12:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352390AbiHSQQ3 (ORCPT ); Fri, 19 Aug 2022 12:16:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC5B1156F7; Fri, 19 Aug 2022 08:59:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7FCEB612DF; Fri, 19 Aug 2022 15:59:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74A3FC433D7; Fri, 19 Aug 2022 15:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660924778; bh=GuioARgipAjckdAdajthvc005UG73r+y/SYqcn3+24w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zU/39ZsBFMH1LedB8fAcQxbVhaVEJQkolp8pWkWPTuv3mGSIolCZV9nFewYvEhrlo J/FfAKXov5Gf/pVKSyvH9n10jMdHgTYeBXuiCHfKVoxMKzlRaR/Be0adm8vEv8n5Ol Xo+a82Ejc3VHx3xe4O8cemr7GEl6yrGql0+jL0r8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Kalle Valo , Sasha Levin Subject: [PATCH 5.10 250/545] wifi: libertas: Fix possible refcount leak in if_usb_probe() Date: Fri, 19 Aug 2022 17:40:20 +0200 Message-Id: <20220819153840.548897674@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220819153829.135562864@linuxfoundation.org> References: <20220819153829.135562864@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Hangyu Hua [ Upstream commit 6fd57e1d120bf13d4dc6c200a7cf914e6347a316 ] usb_get_dev will be called before lbs_get_firmware_async which means that usb_put_dev need to be called when lbs_get_firmware_async fails. Fixes: ce84bb69f50e ("libertas USB: convert to asynchronous firmware loading") Signed-off-by: Hangyu Hua Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220620092350.39960-1-hbh25y@gmail.com Link: https://lore.kernel.org/r/20220622113402.16969-1-colin.i.king@gmail.com Signed-off-by: Sasha Levin --- drivers/net/wireless/marvell/libertas/if_usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/wireless/marvell/libertas/if_usb.c index 5d6dc1dd050d..32fdc4150b60 100644 --- a/drivers/net/wireless/marvell/libertas/if_usb.c +++ b/drivers/net/wireless/marvell/libertas/if_usb.c @@ -287,6 +287,7 @@ static int if_usb_probe(struct usb_interface *intf, return 0; err_get_fw: + usb_put_dev(udev); lbs_remove_card(priv); err_add_card: if_usb_reset_device(cardp); -- 2.35.1