Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3009842pxj; Mon, 17 May 2021 15:29:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfLZrjuI1CWaklnsIUzWO0BlJhrBHxzsk90YCvLTZWWui+Ls75LEo4MaMn8+TcbysWFn/S X-Received: by 2002:a17:906:9bd6:: with SMTP id de22mr2258727ejc.382.1621290563586; Mon, 17 May 2021 15:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621290563; cv=none; d=google.com; s=arc-20160816; b=yfHoQ42NOl/0bcnJgwpCmqH1xsP2r92b2d5h4XhjfxoQGZTR4SSZ3kIYhcVo73jxCU 7r9WIPD4HudKQZwergOcARMbYJOKNVdkcrthmL+SULzQl4hzt+wgabkLcjGAEn3oR9Pj GsiHZkRpwpTWjNdi/EXWRM/uYdek2LqtzSaNwWzLNqzT/jxude14LsvRcJvAnPnsVmSW LaduN8M3DbDIaWiPl1qas/Vnfmn0G6fVjVeESn/MTcyOhnU9PCf8vfw633dlesd3IUtH bkFMPV8AGPbdC0aUuIy/YnwGPTzIEze/9IwmuNCy6kECpneQnsS3Tb/6WGqnFkfVXGrd LxBw== 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=/Fu099P/pJyMpti9Z+tzFiEskStwb363hmi9WfKRbuE=; b=P6GXXcR3gWtIF5Hxxdj3diKI8ffXX6BiQNPcSB7Ga6c3krumKNFEoABuXqGzdYNYWW 96mQgBsdyIhkYhKcYBr2LyM9sqB7rNf6FVtr5f7fcNxEzkSAriLPuzthYh8DGh5TE++o FoWwjQ/dmSM035CyqtMgxs23FPwU/TRYZryZG84yTWg1GNYbaBsAL7jqS79InlMUHR+g DZtmJLCyYFQoCBbf8S2WeCEYxO1T/ubR7njgy7SIv+Uh7l+E/h0mIDGbbXYk+NLEzO65 595ypsrxDbq1BKCZ2mK3OFF+F/ssOwmcwRMXrEuBAqpJu9f3/Y3WOmwM5250f2ezqOfm GaSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Mj077OrL; 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=pass (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 z7si1587918edc.522.2021.05.17.15.28.59; Mon, 17 May 2021 15:29:23 -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=@linuxfoundation.org header.s=korg header.b=Mj077OrL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238649AbhEQONk (ORCPT + 99 others); Mon, 17 May 2021 10:13:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:58468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236441AbhEQOLZ (ORCPT ); Mon, 17 May 2021 10:11:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA3DD613CE; Mon, 17 May 2021 14:07:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260465; bh=B+IHTmOX6U/yt3aMa3Mp9RTA6fBRTDDNgafWLvQ6EfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mj077OrL8licA8p1eNv7/Wc0mPZe6ODL6jb/HKyGYD924jNbLZzn3Akw9Rc5JDCfD QXYKcXz2nro1mOkuITVwn/NYDamJKhjK15uTp7dGHSILcYHgyuc8TWDt4bS9U55k27 B19c2EFEtWO+E0eQl1WMNxbuo3REv89CGXfq9bpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.12 066/363] mt76: connac: always check return value from mt76_connac_mcu_alloc_wtbl_req Date: Mon, 17 May 2021 15:58:52 +0200 Message-Id: <20210517140304.838736374@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenzo Bianconi [ Upstream commit baa3afb39e94965f4ca5b5d3d274379504b8fa24 ] Even if this is not a real bug since mt76_connac_mcu_alloc_wtbl_req routine can fails just if nskb is NULL , always check return value from mt76_connac_mcu_alloc_wtbl_req in order to avoid possible future mistake. Reported-by: Dan Carpenter Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c index 631596fc2f36..4ecbd5406e2a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -1040,6 +1040,9 @@ mt7615_mcu_sta_ba(struct mt7615_dev *dev, wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(&dev->mt76, &msta->wcid, WTBL_SET, sta_wtbl, &skb); + if (IS_ERR(wtbl_hdr)) + return PTR_ERR(wtbl_hdr); + mt76_connac_mcu_wtbl_ba_tlv(&dev->mt76, skb, params, enable, tx, sta_wtbl, wtbl_hdr); diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 76a61e8b7fb9..cefd33b74a87 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -833,6 +833,9 @@ int mt76_connac_mcu_add_sta_cmd(struct mt76_phy *phy, wtbl_hdr = mt76_connac_mcu_alloc_wtbl_req(dev, wcid, WTBL_RESET_AND_SET, sta_wtbl, &skb); + if (IS_ERR(wtbl_hdr)) + return PTR_ERR(wtbl_hdr); + if (enable) { mt76_connac_mcu_wtbl_generic_tlv(dev, skb, vif, sta, sta_wtbl, wtbl_hdr); -- 2.30.2