Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3902513ybi; Mon, 29 Jul 2019 15:01:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0BdukGUVOA59R8C+j8D04hrOt6a6dwn3KuYTcaXlCsXQhX4SJm9vEj6ZmoTLOYqKE/bM4 X-Received: by 2002:a63:1749:: with SMTP id 9mr17075196pgx.0.1564437671583; Mon, 29 Jul 2019 15:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564437671; cv=none; d=google.com; s=arc-20160816; b=TGpP+L32TXjoZ3ReCd0qEIBe8CtYLxm9HcKT2NUDDrDkzSBil1QgdKCgiGXa0zcLFb AzAMYNWnrYpffa7eNellOrd829CAFizKiM3j9Hy3flBAhKVpTZZI2J7XDzKyUxkUeKoA dF7wHeAy2PzgIRAMoKcAGca1WyMQ84bdnhMzAylMcGHEnNa/67CwJDI0skJGsOPGS3sY 3ASb3e1Umm9uJYuFRARHndUie9JeVRclkSd9YjYJBdfJxafqB2Mj2ra6o/Q5AvXsEHs1 tA26ISj/FBkqKXWoMx0MJF766DZnEuzDIypBuuZdQdp4MkKZONZgfh3haceZu4QsSUZY Rbog== 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=0UQkVVTvijBV0k+WumDIlmWPM493/a4fqeRDormYeLM=; b=Wan85wgIi193IzG3QrPDFbcdUq+VgKLK+v/iweQ7rhLeOBoZJFX/I7ywMLeAjAxJfb rnAo/joPOcMNmIMaGYcEiR/gGUK2fT13GI55aOAELNzlLZlAYifBBUDs4Go7WXcJqYmv Zz/27IRSNOy0tzvEVDjCPaPrWoLPcIBZVSLQR+GnWVmHNXjxBUXb1iUMp3Ig5yIa5yjk Xcu+RRqc7Ye4LWMqpB5jfggQcUtZLuZimDmLz0NddXwMZHzx9yRAlddcaQZxLyn5UcQg vv4ePYax+hZydaBQqKTkf+Yak0HzRYCdgDahfoGp6uVTpaWCUmvbE50Y6BE/q1olxstx JkSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ffz5lhjc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b41si26299754pla.409.2019.07.29.15.00.56; Mon, 29 Jul 2019 15:01:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ffz5lhjc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388066AbfG2TYc (ORCPT + 99 others); Mon, 29 Jul 2019 15:24:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:36722 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729525AbfG2TYa (ORCPT ); Mon, 29 Jul 2019 15:24:30 -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 E6E522070B; Mon, 29 Jul 2019 19:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428269; bh=2iO//SbAI3oEhTcJ7mYbIaCQXyRqKuunJiqb7y6axwU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffz5lhjcCMlO+HERtcO6pbLaJWFiE4fuU/7nFa8maiFOJBJlp6OhAY8j9+1K1jv7j dliDnWgdphmFpovzyRRUCXCLpYoLbca5CtV0Qn2N3pUuAwJi0rot7QUO46/M2xYXM1 Kh5rTJIFxfraE4T48kdqJIZnm8xupx7XT99Pfd4c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 4.14 009/293] ath6kl: add some bounds checking Date: Mon, 29 Jul 2019 21:18:20 +0200 Message-Id: <20190729190821.036784088@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 [ Upstream commit 5d6751eaff672ea77642e74e92e6c0ac7f9709ab ] The "ev->traffic_class" and "reply->ac" variables come from the network and they're used as an offset into the wmi->stream_exist_for_ac[] array. Those variables are u8 so they can be 0-255 but the stream_exist_for_ac[] array only has WMM_NUM_AC (4) elements. We need to add a couple bounds checks to prevent array overflows. I also modified one existing check from "if (traffic_class > 3) {" to "if (traffic_class >= WMM_NUM_AC) {" just to make them all consistent. Fixes: bdcd81707973 (" Add ath6kl cleaned up driver") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath6kl/wmi.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/ath6kl/wmi.c b/drivers/net/wireless/ath/ath6kl/wmi.c index bfc20b45b806..d79c2bccf582 100644 --- a/drivers/net/wireless/ath/ath6kl/wmi.c +++ b/drivers/net/wireless/ath/ath6kl/wmi.c @@ -1178,6 +1178,10 @@ static int ath6kl_wmi_pstream_timeout_event_rx(struct wmi *wmi, u8 *datap, return -EINVAL; ev = (struct wmi_pstream_timeout_event *) datap; + if (ev->traffic_class >= WMM_NUM_AC) { + ath6kl_err("invalid traffic class: %d\n", ev->traffic_class); + return -EINVAL; + } /* * When the pstream (fat pipe == AC) timesout, it means there were @@ -1519,6 +1523,10 @@ static int ath6kl_wmi_cac_event_rx(struct wmi *wmi, u8 *datap, int len, return -EINVAL; reply = (struct wmi_cac_event *) datap; + if (reply->ac >= WMM_NUM_AC) { + ath6kl_err("invalid AC: %d\n", reply->ac); + return -EINVAL; + } if ((reply->cac_indication == CAC_INDICATION_ADMISSION_RESP) && (reply->status_code != IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED)) { @@ -2635,7 +2643,7 @@ int ath6kl_wmi_delete_pstream_cmd(struct wmi *wmi, u8 if_idx, u8 traffic_class, u16 active_tsids = 0; int ret; - if (traffic_class > 3) { + if (traffic_class >= WMM_NUM_AC) { ath6kl_err("invalid traffic class: %d\n", traffic_class); return -EINVAL; } -- 2.20.1