Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2313573rwi; Fri, 21 Oct 2022 02:19:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nEz8P0kLhjEvWOjLcDlMQLqawgNoI/7bAMBbZH1OiF0yKFCu0YANoYLtqqUBJb5gi6WVt X-Received: by 2002:a17:90b:1bd2:b0:212:cf30:3d53 with SMTP id oa18-20020a17090b1bd200b00212cf303d53mr2358427pjb.18.1666343982946; Fri, 21 Oct 2022 02:19:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666343982; cv=none; d=google.com; s=arc-20160816; b=jEbpzlniXBA0MRYcQkHCbPWch3OXF5t6psiz3mSGnX44abhhN1UJkX8R6bh9Tafuyz 2Duhs4Y0Y62W7J2+RXN8ctPRXUhGYnzpyJHf/RU3BZva5S6m+FjHjUDQkxjrPHjqXdiY Ocauvw75M2M0LuJALwKM3Myssimpmd1ripVDKM3iag+k2ow3AFR433U2ZOl49QWszyLS 3/zBTP/wPjOfqXCDGBKv34Ijlk9nHbrov+Z2Yufx5gXEXHL7R3FaHuGZev68RzRx6EBl +LOqXw0li5JlMY4QLWX4xASiKbrGM5TIfNQmlj8vMQZkh6JXxSc69ZTCnbIOa95in0Bw ygIQ== 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 :message-id:date:subject:cc:to:from:authenticated-by; bh=q8mpESfOIvTKiFx1g8RRQeppqsTLWuhry2elTqt0Dgo=; b=gHxYEm7440uz0rqYuWVJ/JFYyDOmv+xgZHX3ZSR8jib4yMBQelJ6d/+PcvXjUZZqzF KLQMWLA5h/3ZM6BSZKz7YtCj9NELuRC7XsnQmL/VpXOXW4sUizR40i396/T7mMgyyuVJ E35vbd7BTRhU9C3Ll9ioF3q/FvUYFFqdhLlVMa2cQKFIaJtHNOcQeqryyRttZCciydAO NMSpuNkeYTeoMrcYYC9sMaQzu077vT+uMcCn6t2Y4sujGGDQIfYdN6iyRwSkFQOieL2o XCam2cKLKr0JgTX4bqrY8qMB8Zr1wda0ZF/NM/bLaiA+864rXeqgJa6u76uXiDIMZ/Ny bbHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s15-20020a056a00194f00b00562db93e317si22256449pfk.114.2022.10.21.02.19.32; Fri, 21 Oct 2022 02:19:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231201AbiJUJTX (ORCPT + 65 others); Fri, 21 Oct 2022 05:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231296AbiJUJTC (ORCPT ); Fri, 21 Oct 2022 05:19:02 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2EBFB1E745C for ; Fri, 21 Oct 2022 02:18:56 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 29L9IC9S0029873, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36506.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 29L9IC9S0029873 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Fri, 21 Oct 2022 17:18:12 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36506.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.9; Fri, 21 Oct 2022 17:18:45 +0800 Received: from localhost (172.21.69.188) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Fri, 21 Oct 2022 17:18:44 +0800 From: Ping-Ke Shih To: CC: , Subject: [PATCH] wifi: rtw89: check if sta's mac_id is valid under AP/TDLS Date: Fri, 21 Oct 2022 17:18:28 +0800 Message-ID: <20221021091828.40157-1-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [172.21.69.188] X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: trusted connection X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Deterministic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 10/21/2022 08:43:00 X-KSE-AttachmentFiltering-Interceptor-Info: no applicable attachment filtering rules found X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: =?big5?B?Q2xlYW4sIGJhc2VzOiAyMDIyLzEwLzIxIKRXpMggMDc6MjY6MDA=?= X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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-wireless@vger.kernel.org From: Zong-Zhe Yang Add boundary check of mac_id when adding sta under AP/TDLS. And, return -ENOSPC if the acquired mac_id is invalid. Signed-off-by: Zong-Zhe Yang Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw89/core.c b/drivers/net/wireless/realtek/rtw89/core.c index a0fa9639b5097..557a4dcde1e7d 100644 --- a/drivers/net/wireless/realtek/rtw89/core.c +++ b/drivers/net/wireless/realtek/rtw89/core.c @@ -2413,6 +2413,8 @@ int rtw89_core_sta_add(struct rtw89_dev *rtwdev, } else if (vif->type == NL80211_IFTYPE_AP || sta->tdls) { rtwsta->mac_id = rtw89_core_acquire_bit_map(rtwdev->mac_id_map, RTW89_MAX_MAC_ID_NUM); + if (rtwsta->mac_id == RTW89_MAX_MAC_ID_NUM) + return -ENOSPC; } return 0; -- 2.25.1