Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3980228rdb; Wed, 30 Aug 2023 11:37:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcQkq0AsmviBqMuGAkKllkNQcJi4U8+M//QjM+nJz4tvUHv1GI2XKSoBOYNLNdtm5nj69B X-Received: by 2002:a17:90a:df92:b0:26f:d235:bff0 with SMTP id p18-20020a17090adf9200b0026fd235bff0mr2728031pjv.3.1693420636437; Wed, 30 Aug 2023 11:37:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693420636; cv=none; d=google.com; s=arc-20160816; b=M/d7m54mIuCMFCCBiRY7NxdjZpVuIcTBRCuEiUTVUVdQXzsjbH3JgViahkvMownQjN d2pWXmf0oCCr485RpA0qIfexIQOKLzomISRZVq+R1r8Z3/uCdkJII6AgpFzkI3Ik/qeJ /nBBXvfRb1spZ5HN15K0KNF+GPI3OhKhW1+AMuF+XcPrPdKA/EO0PEYPeiCXjSNJn3qc iiCwqargnVc/8dYhgIffmym4MMMoPRpOPUGeQpRmbhe7yuLRqAkDO4Mg8m3RE05m9ZOf +IROM1P9fqih2GsBUXKZ/hIrFwDiblNRSjBRiSZb4ewraznbGNDeXP6m05A/2KG/O6Sy GC8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=QSpOBhGDEboerpYfQTdunBKU7yMaQ08FvJIYYJHw0uA=; fh=mqKWr/sqlVvXhxGvgSRC8YduF8JtBp5eNmResMOjZzs=; b=nZ1ajfi0PP2ta8+mkgpPfprQUn2Vf6mskYC7DXJCHgSJPvd550cTX7NCT/tOHz4SWF 97wYKSgOnLgC0vRK1mWpDJjaz0wvWA90RmpT0bkmDmELI1JpPdKJ86XE3IjDr1TrbMjQ l6JY6K4npSzn8epI4KBDh1KR+NIMIVsTU5nXdfG5hYvtpxB8BNI+loPlKVpSuygowib0 Ft6kKh42dVCOEvOJOlswAY/mxl5nrvoK2Jqr6Hkc2HNVAicpj4s+VTy/KfBoaF1Zn14m KmQEHgV5SJRNrLSlw96dcv6wriAnVlF9qxgkst1F024Hi/4/JwThUkv4zsq8Vu0MKwFY mPvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iEe0EiPo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b4-20020a17090a9bc400b00268e32e99f0si2371517pjw.28.2023.08.30.11.37.16; Wed, 30 Aug 2023 11:37:16 -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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=iEe0EiPo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236060AbjH2Nay (ORCPT + 3 others); Tue, 29 Aug 2023 09:30:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236001AbjH2Nab (ORCPT ); Tue, 29 Aug 2023 09:30:31 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF9318F; Tue, 29 Aug 2023 06:30:29 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 37TBvnpU014527; Tue, 29 Aug 2023 13:30:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : date : subject : mime-version : content-type : content-transfer-encoding : message-id : references : in-reply-to : to : cc; s=qcppdkim1; bh=QSpOBhGDEboerpYfQTdunBKU7yMaQ08FvJIYYJHw0uA=; b=iEe0EiPoLScS0li1KUKmdOk0cWxWQc8DhsaD0fBRovuXBBCh+jb58DXifDjN2cMXpK2w TJk7QtxgG02zMPItdLfgkaWSOcxAf7VbLSk4fjM3ib68fYrpaeumFDX0qp7r+aI17RjE E0FIqKpxzd+BCXcBDTAABGtBsZWOqnzKB16YSJ1nyuKqUUogxQiXqV83DpeuKrMQuHyG aQ1oe2mz06nyZUOm8+j+WwkruVnKf1E1Du2UtT4blB2PrfROLdfLkYmUJ2uUW0CZJFXz 1n8zEPzudacXfp9qFsCICnw0+PUgzUzR7pUVlfhhbaKp9cqjhJK8sBNnC8WjY64zGfX8 8Q== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ss7meseh5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Aug 2023 13:30:06 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 37TDU6Tx031789 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 29 Aug 2023 13:30:06 GMT Received: from hu-jjohnson-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Tue, 29 Aug 2023 06:30:03 -0700 From: Jeff Johnson Date: Tue, 29 Aug 2023 06:29:36 -0700 Subject: [PATCH v2 1/2] wifi: cw1200: Avoid processing an invalid TIM IE MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20230829-ieee80211_tim_ie-v2-1-fdaf19fb1c0e@quicinc.com> References: <20230829-ieee80211_tim_ie-v2-0-fdaf19fb1c0e@quicinc.com> In-Reply-To: <20230829-ieee80211_tim_ie-v2-0-fdaf19fb1c0e@quicinc.com> To: , Kalle Valo , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , "Christian Lamparter" , Stanislaw Gruszka , "Helmut Schaa" , Ping-Ke Shih , Johannes Berg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , , , Jeff Johnson X-Mailer: b4 0.12.3 X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: 2TLM-G4UVmX0kCp65y5iSYbnX96Ylw-- X-Proofpoint-GUID: 2TLM-G4UVmX0kCp65y5iSYbnX96Ylw-- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-08-29_10,2023-08-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 mlxscore=0 bulkscore=0 adultscore=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 mlxlogscore=694 phishscore=0 priorityscore=1501 clxscore=1015 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2308290117 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 While converting struct ieee80211_tim_ie::virtual_map to be a flexible array it was observed that the TIM IE processing in cw1200_rx_cb() could potentially process a malformed IE in a manner that could result in a buffer over-read. Add logic to verify that the TIM IE length is large enough to hold a valid TIM payload before processing it. Signed-off-by: Jeff Johnson --- drivers/net/wireless/st/cw1200/txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/st/cw1200/txrx.c b/drivers/net/wireless/st/cw1200/txrx.c index 6894b919ff94..e16e9ae90d20 100644 --- a/drivers/net/wireless/st/cw1200/txrx.c +++ b/drivers/net/wireless/st/cw1200/txrx.c @@ -1166,7 +1166,7 @@ void cw1200_rx_cb(struct cw1200_common *priv, size_t ies_len = skb->len - (ies - (u8 *)(skb->data)); tim_ie = cfg80211_find_ie(WLAN_EID_TIM, ies, ies_len); - if (tim_ie) { + if (tim_ie && tim_ie[1] >= sizeof(struct ieee80211_tim_ie)) { struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *)&tim_ie[2]; -- 2.25.1