Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2914309rwb; Mon, 15 Aug 2022 13:58:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR5pkBoDfWpVxHtfSYTRSn8UlKGQwRDlZlkwhCYKMtV3nN3geMQA7mlKjkxC459YDNlAIYmj X-Received: by 2002:a62:6446:0:b0:532:3d30:cf3c with SMTP id y67-20020a626446000000b005323d30cf3cmr17790759pfb.72.1660597117735; Mon, 15 Aug 2022 13:58:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597117; cv=none; d=google.com; s=arc-20160816; b=ey0QMU3UYCwmqBMaOJjs9GcxkoVhis0Gp7Etnk5oenbnW0Fwgxn8+SwQoPL/UBSZCG 5KnMkzz8WfMbpdMlXW5wByPGDCZ2kaj5Hjm5tVTs8z1qA0I7F52GojvT52k9Cft9HRMu C7psHyA6eBmIdZ1aLHXzpf0gdOR7jod1RUQyaCEPF894bghf2lx4YE3GU6HrC4nH+poW G/S0GSlaLt2EdRQ8uWpFVLXwgY2im9Ndxl6rIVkrmAXjPJWZvZr8lAm+TC1PrxTuDWs6 OGby3kBxIBsO1Bx+2nOIFlwfTpzQsc8wSfau7BM8gL5/AKiAnfl6Mps9F5ZC1jt2eJb+ +MrQ== 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=DgBGxAfqPEkDwzmPP59FKv1LV1pHzb6VrBe+EDjzgyd4WdmZHeW5BCFzRRksIyUhfb T4VkmiIQznnm4+UBUINGgqcVjrBiFXoC/mrNxVu48VXSX/uzY1kcWyOIJ//azgngFcgM zewoUHIHIIXTil/hpjUeyb8bw7V8DQJ7roEgrWSVztplpTh3byCBl8vWgmTYmp0cMXDA ZPWBGLiHgTPG2nNOQAG2gfA9ASLCIWc/RN869HF/KYNB13tTvUqMYkgrvHjuI/zit94T GNoXoMpsOh1X1H9zEIntuNHrg3ttDYKkfB/xpWdamO3AYSBJh2jzH+QLwps6lYSVbPQO xy3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cxmwmtRX; 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 r24-20020a6560d8000000b0041cfc9ef388si12213514pgv.159.2022.08.15.13.58.26; Mon, 15 Aug 2022 13:58:37 -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=cxmwmtRX; 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 S245243AbiHOTDs (ORCPT + 99 others); Mon, 15 Aug 2022 15:03:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245201AbiHOS5A (ORCPT ); Mon, 15 Aug 2022 14:57:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5F932EC4; Mon, 15 Aug 2022 11:32:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 56AA3B81085; Mon, 15 Aug 2022 18:32:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 963D5C433C1; Mon, 15 Aug 2022 18:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588322; bh=GuioARgipAjckdAdajthvc005UG73r+y/SYqcn3+24w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxmwmtRXOAztLvZuK5KFD5VGNoqoiEG6wJO6HJ2TKrjjQUMggLviiiiYzLfDA5qY2 aAIrn3ggHaRlJ2eK5mBD0LrTTTrJvqn0D7SBgmthi1MA6WVo9fm11Fk5GhCI+9ZPOS 1HGsYpMGxiwbY06KtUU5rWFGeXW4AfrJ+vqn0riE= 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.15 366/779] wifi: libertas: Fix possible refcount leak in if_usb_probe() Date: Mon, 15 Aug 2022 20:00:10 +0200 Message-Id: <20220815180352.894143878@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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