Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp741132pxb; Tue, 5 Apr 2022 21:15:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxH90MENOnBwx/lcoW0BVObhaO12ii4PPCLBCeiqYQEnZZFlTycXHG9lVQ20y9uepELVS5p X-Received: by 2002:a17:90b:3849:b0:1ca:95b3:599 with SMTP id nl9-20020a17090b384900b001ca95b30599mr7796333pjb.167.1649218505706; Tue, 05 Apr 2022 21:15:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649218505; cv=none; d=google.com; s=arc-20160816; b=HILbl49oEEw1pkGZev4UrPqg54K/w2evSd4KKGz49DkvsfaLknFpsrfdIf+aBVWyNi 0BrmS03nBgU3O7VWFYvkSoWbZThLYhdowvyjWne2vdFffPWWrZsBeeyyUsfiDV9Fxfky F/Dfe4sUWhb9dC4M1INdnAf4ysI7g72y7h+Fldk+fuz4TXoqA4gHl88MuxcDSjT3EEbI ugjsd++Vr8HZYF9+jBf4RCoH9jlrH+kNf8LjBYmMdXrgdCv7mRQq1BYXLBnbPEHJyrKH xU6SYe5xwcSPtshNHSzzMMt8fF8Nzu2obKH4z7/uj/WLaqahdOgqBG+47SZG8S+LKqp2 Y20g== 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=wjBWKkMsReTu5KKc752Q8q+Xkb3Ltf+LS4AhoSCnUWM=; b=xSOn4DQwr4bmffrlc1yBPc7CNQ8QGKLTXiQH2HQ3TzMYEEGXbhoFHyB1Z+M8hPW3p3 /sQJkGdJc2FFEROMjoIor+JGd5G9UdF9HwVftGb4FX0FXN3I4xUo19LH0xITwfbgGbpW ktLeRPOM2Q4YE6DOnMIN4L6K97ai14Ie++5g+apRvTpE1L+hO8nVmVN1MZ5fWGPHLuc7 jsVKC9pb10VmovQP+93blT8pDXsz5f9J8xi4BlTwozrSxe10oSyj+okBxdKxYA3t08kC AyrIe5jNZhaoGLWkyc5NNSFdQeEO+bS2KrzMoJmo26+h8bmFbLZ1ep39S4xUB+Vwjfp2 wZ1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aL9S0aXb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id nl12-20020a17090b384c00b001bd14e0302dsi4310434pjb.5.2022.04.05.21.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 21:15:05 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aL9S0aXb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EB741185472; Tue, 5 Apr 2022 21:08:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245108AbiDEIyH (ORCPT + 99 others); Tue, 5 Apr 2022 04:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233806AbiDEIIx (ORCPT ); Tue, 5 Apr 2022 04:08:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F42036C904; Tue, 5 Apr 2022 01:02:23 -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 5B2CC61748; Tue, 5 Apr 2022 08:02:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 681E1C385A0; Tue, 5 Apr 2022 08:02:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649145742; bh=sLwL2qpxVBnB32ES/8Ty5wpNoUexmJ1gY52PilcPFao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aL9S0aXbFgOJVDjIqNZwnfaAwVGe0mS1axCs5HKQOAuRSAcj1POBa1VnbWYzq/vCN /4Pa04r0I4wfaQjufMn2GoBXL9dT8bJ88SFDdQT/ZnmaR9UkISm2Ic/i/NP4mjNXNh VlGNkG6IyPkzeXz6Y7fif2ortiBX3YObK4J+qV5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.17 0506/1126] mt76: mt7915: fix possible memory leak in mt7915_mcu_add_sta Date: Tue, 5 Apr 2022 09:20:53 +0200 Message-Id: <20220405070422.479819690@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 From: Lorenzo Bianconi [ Upstream commit a43736cd12d82913102eb49cb56787a5553e028f ] Free allocated skb in mt7915_mcu_add_sta routine in case of failures. Fixes: 89bbd3730f382 ("mt76: mt7915: rework starec TLV tags") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c index b2b3b5068789..1afeb7493268 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c @@ -2399,8 +2399,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, } ret = mt7915_mcu_sta_wtbl_tlv(dev, skb, vif, sta); - if (ret) + if (ret) { + dev_kfree_skb(skb); return ret; + } if (sta && sta->ht_cap.ht_supported) { /* starec amsdu */ @@ -2414,8 +2416,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, } ret = mt7915_mcu_add_group(dev, vif, sta); - if (ret) + if (ret) { + dev_kfree_skb(skb); return ret; + } out: return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_EXT_CMD(STA_REC_UPDATE), true); -- 2.34.1