Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3329437rwa; Tue, 23 Aug 2022 02:59:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR7GUj7ZC6xQqEbZdY9PbvpsOduUO0hjHs/02q+rfpAhw3oN8YM3j1OHkmU4IqsA4zLloO6x X-Received: by 2002:a17:906:98d5:b0:73d:5a93:5f59 with SMTP id zd21-20020a17090698d500b0073d5a935f59mr11704795ejb.743.1661248765555; Tue, 23 Aug 2022 02:59:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248765; cv=none; d=google.com; s=arc-20160816; b=xgw61A0rre4VL65L97dKrPWzAZ0IcrH1JbK9dKlE4Qjq0GDrJVcsewzEDKTCKSfpRL Onw17kbCZBkx5lUj6VQofU4BsE/9AbIYS3h4xIXt5I4haMN5faDd/yhQAkHFT0C/YWkg 1QEg1IvrP5lqX88+Y232pi+/kX7Q3zYdSG8IiNWlKBRcJtNRkOShPFGxASEjECMSkBbH eqR74E2MgXLy0djOP2m3uRoZitJNzYdXqhdPGrReYwcUHt6L5tX4twKejHlVOKvt2+np mQfUs21yFVxh0ZXHW+VqeYmbdUO+525H1Yg/E4mVBbQSCpi6QMeMZ5fS5XWOpr3Fw6yB MBtQ== 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=LjyOZIqtmS7ZuAPE7ndW2EgMM1ArIcOk3Hzwb+ScqSI=; b=oUpst8J154uEau2Lo8B3YI6UfXnoPzr7iAUWiOA5YLbBpFOpnMWaqor/G3PdD8btZL wqx08FaUzP1cx6kGzmNGX+UqHi83/tFuhB21M2DklNMsVQ1Xyh913hytu+6zJ+2HflI0 quIVYwQ9xgFGmMLvhhWTtqNijOoEvzIcKmZubDgoQBc6KkpYW9jrgmuF0p/ExrE/1x2O JRSOCGz82UzMchO/FEodBafC78vJWYyJbVkiFE9SqnlQJr/l4pDdcstGdCtI7gEvFSDi aR1vxaVzL+UxIBBpotGiIcmdfT1/gXw9IjP15tSTpzqetHu7aW4g2bcH2s2+KLKFPF9X S7Fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=sXmT0FnK; 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 g2-20020a50d0c2000000b004466b488bcasi1867892edf.216.2022.08.23.02.58.58; Tue, 23 Aug 2022 02:59:25 -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=sXmT0FnK; 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 S241875AbiHWJrH (ORCPT + 99 others); Tue, 23 Aug 2022 05:47:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352623AbiHWJlk (ORCPT ); Tue, 23 Aug 2022 05:41:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BCBA7A52F; Tue, 23 Aug 2022 01:42:18 -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 86FB8B81C20; Tue, 23 Aug 2022 08:42:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF509C433D6; Tue, 23 Aug 2022 08:42:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244137; bh=tczueR9QBrw1L/jEpqXkCntMM2hD+Z9tSAUmw/5z380=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sXmT0FnKtAtFel77Td0/pHjK1QCUPIm18rEFhL0/6DNYIWp+dfcrqxoHWnRrzMP2S 7JqwNg6HaQaN52W4q+7T9XVL8B7+Igxwl1T9DFD1nnfBXI+k5IBg1WK3qZ3U506fB1 lodt+JTTgSuWxKJuRU8+/zx00iB0N+mOwZQJ0Hns= 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.14 091/229] wifi: libertas: Fix possible refcount leak in if_usb_probe() Date: Tue, 23 Aug 2022 10:24:12 +0200 Message-Id: <20220823080056.960820374@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 bbfc89d9d65a..40a8003220bb 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