Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413998rwa; Tue, 23 Aug 2022 04:30:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR5krCEP4Tgzmb47x8PO9YonXMo5fppjmZpniPqYEb0aZ3v/xH1lx6BLcJXImjAHDLsvMZKP X-Received: by 2002:a05:6402:329:b0:446:3137:b4fd with SMTP id q9-20020a056402032900b004463137b4fdmr3359838edw.426.1661254119414; Tue, 23 Aug 2022 04:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254119; cv=none; d=google.com; s=arc-20160816; b=fGQG04mFU4yZvuWV0v35kwL7qfLmTeRq/68ETwRx1DCo31LpGf9pnMnIzsOvjz6xQ1 4ZNiOqUDBSLi/+yGIIWLD8Ht7GDFhrF42NrhR2kO24P1e2bJRtAL6ueYIqcSIT7yCB+R zHmwNQwugB+9KxRDEnipm1enTWPRW2jQQZE9fgqg6TUZoUK3I9XkKiNYUjIZU4nUGkrs tU1KitShXiuBPmivd1uE0LFC6aC12TGIhz40G2N6JZ+W4sZRWb4MgBX/EqwoLZfK4s0Q vZqw3fVXLqfHa9jsatBc7m28ymIQb39KOQ+0gl7qSupFZoVDr2lhwvAch0kOPm/ZQUvV gD0Q== 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=8Qp8A7DvJ1hDdFVbNo0QWyCbHeytkpgyb8pcUrjpa5U=; b=TtcBN1FeLrtXx7fytoRY7WbIN1dieUKTee0vyma0ZTQaf3KJNgsyECkOQlG+XAOmGn HxXzUYR2KvcO75rMhCM0NKcivxAmeokbK/v03g9Pv9VBWwB1W0r3CKR1I5oclRwOg7i0 MnwBotqg382vmUnGlSCdfFxjriu8RAGXV6Tf3udHAYbr2s5bwKWg4TMjXJBfcLI6ae6w YHJ2rP0lsrPD5CtnyMdMuPY6xpOZq/dVi2xk2JcHcH/rIcOEyte+cjL/lf5UPJ0DGJTr ZWql4A6CPas+JOgul0FaJix9RrPS/dnIH+WLF6HPjkow5g0Nn3Bp1qBGsDIqgBPgqFIP JJzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UFYi7mpS; 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 hu8-20020a170907a08800b00730cd86905dsi11545589ejc.80.2022.08.23.04.28.12; Tue, 23 Aug 2022 04:28:39 -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=UFYi7mpS; 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 S1355759AbiHWKok (ORCPT + 99 others); Tue, 23 Aug 2022 06:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355641AbiHWKgr (ORCPT ); Tue, 23 Aug 2022 06:36:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9347A61E1; Tue, 23 Aug 2022 02:07:16 -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 73EBA6158F; Tue, 23 Aug 2022 09:07:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6635CC433C1; Tue, 23 Aug 2022 09:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245634; bh=1+IUZhHuzUKYewP4UBn01S5+ePsHSJ5sNU45ZneqJnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFYi7mpSUqQnq9di6GotWcuQ1R1SMHGgqM3e2IynI8p69bxaj2UG7OaJiwQvXGz8H F0eNVLX6mxcfYPRpz/NTl/4Wu5VozCP3uKCzbJSts+OAnYbLR2ELUAnvfSkEk/VImF qPe0DiaIwghIDpQ40o5Uo1eB2hF9pkIFryAAURQk= 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 4.19 108/287] wifi: libertas: Fix possible refcount leak in if_usb_probe() Date: Tue, 23 Aug 2022 10:24:37 +0200 Message-Id: <20220823080104.010816510@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 f29a154d995c..d75763410cdc 100644 --- a/drivers/net/wireless/marvell/libertas/if_usb.c +++ b/drivers/net/wireless/marvell/libertas/if_usb.c @@ -283,6 +283,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