Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp529602pxx; Wed, 28 Oct 2020 10:22:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwHyCRh9xtV5ulJkmrUTmXr9xlQ6F87CpJGd0MnAS4poYuPaX5MUNwhDP89MD+oCyjW/Lq X-Received: by 2002:a17:906:4410:: with SMTP id x16mr80119ejo.307.1603905765240; Wed, 28 Oct 2020 10:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603905765; cv=none; d=google.com; s=arc-20160816; b=JF/IuokRMkMQG4FTVhw43ofE5NVEkMe0mZ7e4lFkXzz6VasynXyOf6D7Mh7DWwZ5S4 nVtAT+Z3jNxtEXGGyFApmByKGjZuf980uuG0E8Y1oSodSEHNvMqcIjAZn6Biy7q99qOc rbVrR7zEp3V47i4eRMonjrIzIpCHD4frEHbW4X9G/TzLQ3b2PGzR2ZZ9CSY857EG1kuu cDzG6natFEMRmbZkH8kQ3oEne85ZcCY5xE7z2IbOEufWDBpa3I4ebWPF+RVH6hLdobHC 3K8dgTaWIBUjYfG7JfCLz79mi45JPgLFLySC9P7xahiFpmvubwXseVfDJi6ddEaQs/kI l+uQ== 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=gJR1vpzyNn96BzfzU0OWy2xkJhKutEWcxvRI/i5quFM=; b=I8bi0rvZAWWh1BtFc3a+MNzEIUhSSOFRonLHQp4QAtAvxfr2ZMF52UFZ4rfrac/fhw GGrggQfx8hn5K9oA61K2e1hRLd5l0pa6+A1m/tdbgR16MFQi4dfm0HLPVAhfTf73+3o/ aqTse6bTiBTAEh3ChguInkoruGKVro2/KHkfFV1PubSRXMZTPP9EXzOHcQ9Dfa6XtToy CBhWyvB+4w8UefQ3gJNml+yvglgkslPohOmk5Zg0Xr3zYI0lVN0HaWqBd+qz1k0OhazB 5iRk29O1l/6w8ZRfjXdP7ey2LwXacE/1V/XK5cokrNli52fGZtV7UALXX+EidGgsUYgV E/zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=x26BRCKA; 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=fail (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 h20si3592583eja.402.2020.10.28.10.22.22; Wed, 28 Oct 2020 10:22:45 -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=@kernel.org header.s=default header.b=x26BRCKA; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1821152AbgJ0Rku (ORCPT + 99 others); Tue, 27 Oct 2020 13:40:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:60164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2902416AbgJ0OdP (ORCPT ); Tue, 27 Oct 2020 10:33:15 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 F347120709; Tue, 27 Oct 2020 14:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809194; bh=y2X8Rlzg/9+h3mtkY/LayOwdA5+JyHTtV2Uy9gV+c5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x26BRCKAVOITMxyfvBu3R8csUmeTi4uysd0/XVuvyPwQBYBEntEBNnewO2ngngZNn GlbXErq/Z6uOp09dY5kSibgdzg7p/U4rPjnZSFMXihi1Q83XfufDbKHlIL+cL9FmEV 5mISeeOZhnGFhDCHZxg8xfeBvfvQqNkUCr7fRO/Y= 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 5.4 109/408] ath9k: Fix potential out of bounds in ath9k_htc_txcompletion_cb() Date: Tue, 27 Oct 2020 14:50:47 +0100 Message-Id: <20201027135500.156569403@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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: Dan Carpenter [ Upstream commit 2705cd7558e718a7240c64eb0afb2edad5f8c190 ] The value of "htc_hdr->endpoint_id" comes from skb->data so Smatch marks it as untrusted so we have to check it before using it as an array offset. This is similar to a bug that syzkaller found in commit e4ff08a4d727 ("ath9k: Fix use-after-free Write in ath9k_htc_rx_msg") so it is probably a real issue. Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200813141253.GA457408@mwanda Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath9k/htc_hst.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/ath/ath9k/htc_hst.c b/drivers/net/wireless/ath/ath9k/htc_hst.c index d2e062eaf5614..510e61e97dbcb 100644 --- a/drivers/net/wireless/ath/ath9k/htc_hst.c +++ b/drivers/net/wireless/ath/ath9k/htc_hst.c @@ -339,6 +339,8 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle, if (skb) { htc_hdr = (struct htc_frame_hdr *) skb->data; + if (htc_hdr->endpoint_id >= ARRAY_SIZE(htc_handle->endpoint)) + goto ret; endpoint = &htc_handle->endpoint[htc_hdr->endpoint_id]; skb_pull(skb, sizeof(struct htc_frame_hdr)); -- 2.25.1