Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2658338pxa; Mon, 17 Aug 2020 15:45:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA3AmvZT+9FbJM2pwvHOjHnvILPQGDrzrU/5KlmPngOrWDdnJIQ69U10bDt0HsFLhag0p5 X-Received: by 2002:a17:906:4007:: with SMTP id v7mr17763496ejj.197.1597704310471; Mon, 17 Aug 2020 15:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704310; cv=none; d=google.com; s=arc-20160816; b=OvQQ7n1y6PSENFUlbgutVLnR/ae899k4VLqcss/xq6WE70ttrzzyFRv9ihYN4fQnj9 EiIgo4fM4YobregES1vnY5b9ZNER7uEQfvF3afxTW+/ET2+at4d7bJ5lECsLQiGW8Dfh 515sXE9LHuYr7Zd8TGadyTj4V9Lxb6lU0wSG4NgzzKvmIZgJrl+dDmSslAdGpgwpQxiP zREaENXzgknljyUy37dBWFEd79PC2U9ImpjB9Rw1nEq8Lq/fvI4tcU5XFtnfZLmLw3T9 geQQBVcliNkO0h3CUGyGHjaz+53DQQTEc2A/l5H9a5GVR/v4J8mYwcq2XJl+8HbMnv3M G/Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ACR6xQxNxPLmXde/S6DACElrYLMXlu3aINoljK19f7A=; b=lnFM9ONo0PwHz13+y03xYbbkDRh0ewQMJWY4JxMqeFwVPUNEQZ4TUpIEoBUNiVw/Wf eRW8PPfWs/NTqnVdPnqh5TA+1rf/Ksf3rOnAsCfgzmkP4EArhWNnuF8aWHSKpl9UTVJH nKjoPW/4ND5jqSOzHUvNeUZTkDsJmHnBfDTE7Y2Q/L4HGrGOAR2UKV6x4CfRNrs/j6yn qmqA+q45NY1Gk4NZGN5fRhGY0WqOZtPryhcrB002Atcw77FoHR6L3ce3QTBb7isY2pKX /XsLfeU4lYzIoMk9GohfN8FCE5P/n+qCVPf3mz52JzdqI+9Sw/vt46Bouo+Q+V3/iO7g XZzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P2DPLvB+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i20si11806433edx.426.2020.08.17.15.44.47; Mon, 17 Aug 2020 15:45:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=P2DPLvB+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387680AbgHQSx6 (ORCPT + 99 others); Mon, 17 Aug 2020 14:53:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:36512 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387803AbgHQPvl (ORCPT ); Mon, 17 Aug 2020 11:51:41 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D64E208B3; Mon, 17 Aug 2020 15:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679500; bh=xahJdK5HOHjZ/sQrsJBMAbZG1S10XcSs6h1S6y1Lf64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P2DPLvB+1FvErWLLQ4CSq3Jt87737uM4P0LY+m9hn7P1qu7zTVOey+NcHhSCKIC2L D0afA0ATbUT/rIkfqCzcKceyDJKF9iQj+JhDw9OkizwPr3uEpzwqHpmlu372YAJsJ7 FGYbhU/iOAfNrmqRX/47GoUXI3LRTEuu5gl7ZA5w= 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.7 234/393] mt76: mt7615: fix possible memory leak in mt7615_mcu_wtbl_sta_add Date: Mon, 17 Aug 2020 17:14:44 +0200 Message-Id: <20200817143830.972501520@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit 2bccc8415883c1cd5ae8836548d9783dbbd84999 ] Free the second mcu skb if __mt76_mcu_skb_send_msg() fails to transmit the first one in mt7615_mcu_wtbl_sta_add(). Fixes: 99c457d902cf9 ("mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 9c55424962522..81d6127dc6fd8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1036,8 +1036,12 @@ mt7615_mcu_wtbl_sta_add(struct mt7615_dev *dev, struct ieee80211_vif *vif, skb = enable ? wskb : sskb; err = __mt76_mcu_skb_send_msg(&dev->mt76, skb, cmd, true); - if (err < 0) + if (err < 0) { + skb = enable ? sskb : wskb; + dev_kfree_skb(skb); + return err; + } cmd = enable ? MCU_EXT_CMD_STA_REC_UPDATE : MCU_EXT_CMD_WTBL_UPDATE; skb = enable ? sskb : wskb; -- 2.25.1