Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp6770ybz; Thu, 30 Apr 2020 15:23:06 -0700 (PDT) X-Google-Smtp-Source: APiQypKdWQjmGCZJbtioyYED1o2NfofuTr5m7T6yPMWTzCPFIfJWrgkm274STAv1wNO+NA7bp0Yi X-Received: by 2002:a05:6402:221c:: with SMTP id cq28mr1102368edb.50.1588285386767; Thu, 30 Apr 2020 15:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588285386; cv=none; d=google.com; s=arc-20160816; b=Ipw0gKf6LpSziFmv7F/zECya5pkKsSCQu6SJId5055eNBqfbk82JDiTTtzTRgtUm1/ HGfgBIQlVNVQomvLVtal5XLxpF9K4EdM2rN/KQ92tf/yqLjIRLisnYkminxGcpmwxkNz wtFBE+klvcyWaA/7BddE6U6M6fW5Nldb4L31cfRITQ0U9EmIcPRdjLtpHCiWalvjRQfC so0+3dPM7BuUZHYj7A6UkR/W6rI3oRxSeyrVfzG/XzT78DE0RlvtWg8/ZBHHdIdHh5Ex p/+LPplVoIsRcy/1PsC0HC8OKiyfBKyr5pe6YY+6HmZ0KFa7YU1kOw6BKl7Hau/nUvep 2g7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature; bh=qI0MCgapxJM2yN2WArwQzjt/VfFHUH0kGqFscZOMrHg=; b=hB0HYyuCPECi7CWjJpMMm0OKA4+pZmDD8Q49hdRTXZHtPR52586Q5KhKbXFJWB5KhH Qq2D07tDUtgO1jrlW+1+53s4+J7hRbRLxNsG0jVLstxgYqoXrcVEbjKdGmgHLmb0x10v m74hW0t2FbIu3+eLthc9/26ZvxXPvoPv/e+BGA2ySiFfAlvxVGGOkr1Jv90jga/JReca /Gyx4hmAJSPE9k2MCAOyZt4lu86GRUdJuk74l6wCrzW9LRBw2KgKausxUVGfZCWZsKsd tTBcY/GjZimO/ws5BUhn1XohcmWTSaUizWZnhIS2yGeA98AakQ5DFiFaS8xAUa3Wyp+8 CLwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=bJxOktyv; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g88si748723edd.505.2020.04.30.15.22.41; Thu, 30 Apr 2020 15:23:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@mg.codeaurora.org header.s=smtp header.b=bJxOktyv; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727869AbgD3WVc (ORCPT + 99 others); Thu, 30 Apr 2020 18:21:32 -0400 Received: from mail27.static.mailgun.info ([104.130.122.27]:34947 "EHLO mail27.static.mailgun.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726697AbgD3WVc (ORCPT ); Thu, 30 Apr 2020 18:21:32 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1588285291; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=qI0MCgapxJM2yN2WArwQzjt/VfFHUH0kGqFscZOMrHg=; b=bJxOktyvzojdlgaxDWggx3HI0iKhRcolTb4ZrjrzSiOrnxKQIGbxJCp0Y94jrB0HebCw2Wz/ NGnVKZfyaBu6W746rVAl0P99hYBYvwg37Qh4YBKoN0o7B+qaVMKWCYXf2dmF1xXJYvP4CtZ5 hpNd2i8N7mwB95J9XNLCYgbeHSI= X-Mailgun-Sending-Ip: 104.130.122.27 X-Mailgun-Sid: WyI3YTAwOSIsICJsaW51eC13aXJlbGVzc0B2Z2VyLmtlcm5lbC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5eab4f5a.7f7d50e2a148-smtp-out-n01; Thu, 30 Apr 2020 22:21:14 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8665BC433CB; Thu, 30 Apr 2020 22:21:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.0 tests=ALL_TRUSTED,SPF_NONE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from rmanohar-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rmanohar) by smtp.codeaurora.org (Postfix) with ESMTPSA id C367AC433D2; Thu, 30 Apr 2020 22:21:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C367AC433D2 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=rmanohar@codeaurora.org From: Rajkumar Manoharan To: johannes@sipsolutions.net, kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Subject: [PATCH v2 05/11] mac80211: fix memory overlap due to variable length param Date: Thu, 30 Apr 2020 15:20:46 -0700 Message-Id: <1588285252-30034-5-git-send-email-rmanohar@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1588285252-30034-1-git-send-email-rmanohar@codeaurora.org> References: <1588285252-30034-1-git-send-email-rmanohar@codeaurora.org> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org As of now HE operation element in bss_conf includes variable length optional field followed by other HE variable. Though the optional field never be used, actually it is referring to next member of the bss_conf structure which is not correct. Fix it by declaring needed HE operation fields within bss_conf itself. Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath11k/mac.c | 3 +-- include/net/mac80211.h | 7 +++++-- net/mac80211/he.c | 13 +++++-------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c index 9f8bc19cc5ae..06d063274eea 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -1168,8 +1168,7 @@ static void ath11k_peer_assoc_h_he(struct ath11k *ar, sizeof(arg->peer_he_cap_macinfo)); memcpy(&arg->peer_he_cap_phyinfo, he_cap->he_cap_elem.phy_cap_info, sizeof(arg->peer_he_cap_phyinfo)); - memcpy(&arg->peer_he_ops, &vif->bss_conf.he_operation, - sizeof(arg->peer_he_ops)); + arg->peer_he_ops = vif->bss_conf.he_oper.params; /* the top most byte is used to indicate BSS color info */ arg->peer_he_ops &= 0xffffff; diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 97fec4d310ac..2af956bdf80c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -603,7 +603,7 @@ struct ieee80211_ftm_responder_params { * nontransmitted BSSIDs * @profile_periodicity: the least number of beacon frames need to be received * in order to discover all the nontransmitted BSSIDs in the set. - * @he_operation: HE operation information of the AP we are connected to + * @he_oper: HE operation information of the AP we are connected to * @he_obss_pd: OBSS Packet Detection parameters. * @he_bss_color: BSS coloring settings, if BSS supports HE */ @@ -666,7 +666,10 @@ struct ieee80211_bss_conf { u8 bssid_indicator; bool ema_ap; u8 profile_periodicity; - struct ieee80211_he_operation he_operation; + struct { + u32 params; + u16 nss_set; + } he_oper; struct ieee80211_he_obss_pd he_obss_pd; struct cfg80211_he_bss_color he_bss_color; }; diff --git a/net/mac80211/he.c b/net/mac80211/he.c index 1087f715338b..f520552b22be 100644 --- a/net/mac80211/he.c +++ b/net/mac80211/he.c @@ -57,17 +57,14 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, void ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif, - const struct ieee80211_he_operation *he_op_ie_elem) + const struct ieee80211_he_operation *he_op_ie) { - struct ieee80211_he_operation *he_operation = - &vif->bss_conf.he_operation; - - if (!he_op_ie_elem) { - memset(he_operation, 0, sizeof(*he_operation)); + memset(&vif->bss_conf.he_oper, 0, sizeof(vif->bss_conf.he_oper)); + if (!he_op_ie) return; - } - vif->bss_conf.he_operation = *he_op_ie_elem; + vif->bss_conf.he_oper.params = __le32_to_cpu(he_op_ie->he_oper_params); + vif->bss_conf.he_oper.nss_set = __le16_to_cpu(he_op_ie->he_mcs_nss_set); } void -- 2.7.4