Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3648726pxb; Mon, 24 Jan 2022 14:23:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqvRvScLULHqx7Z34H3eoCQ7ozyOs6EyR52W8qnEBH4I8WSlIsryhh9AeFy/LUL+MbtmjL X-Received: by 2002:a05:6a00:2c3:b0:4c9:ef02:e252 with SMTP id b3-20020a056a0002c300b004c9ef02e252mr4075464pft.64.1643063013409; Mon, 24 Jan 2022 14:23:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063013; cv=none; d=google.com; s=arc-20160816; b=gpJDcM/zeQZKqnZHfZkfXJjXbTlwZz51PMwJuhwSrZmAhB9u95wTFaXBi8S3HTHdlp YcxJNadjy2BQHORdX2NiF4kaJLasDj8qNhdGEG9cNkySGbCK9/fwEj0kg5DIhxYySQBl L8oAq3WvuvQ/ceHBZOVA/KuoSXP0AKkqX/btBmvld8iNC0tJdndpsvTPE355+9pd3PRX NCJDYH++8cCTIeN5pkChyiiSd6KfKebYJMEEUuy7IcRNHGS8mF0ecDJVKXOTbXhntZ7E Z+ki801YUzxzsUVdGeoYI4AnoE/nXFv1nClOw9rrGroqmtyQU0ns2JmWJvxsIELqWxOD mojQ== 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=aojY3DTpiooThYHY6btkVwbU8skw0gICEqAiC0xwKt8=; b=oA5UHBHcJ0LqPF8Sdsc0dlFwTmNVBmnrxHjPNMSGve7mPULpEnDqKJFb5LS38Y2u5v TKF/cmbrlDytLQXSWO+13f+zIQUMhX8Acg6KK5K1mNEnlQ0qEsSdo21mJW6pi3O6F7I9 QEV5XhkF4Mw/6Aop71RvClnu6CUaZaTLrqwpykDvQxfPlTvMicGg1de68V3X1l/XYAWn ThKTr5/J82OF0vEHiQpN2MKvftQ+S8BaMQsKPpCnRdtV+JZSiqC40Sy+ze863+kBHgOp 6BiRIyaZipu/3awrUESFdy8NYQPNcMmrg6Tsls/GIXHscQSGMJ45aAHwU3QUAuo6vXYI 6QVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TMSWFwYD; 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=pass (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 b5si14347198plz.335.2022.01.24.14.23.21; Mon, 24 Jan 2022 14:23:33 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=TMSWFwYD; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1582198AbiAXWOB (ORCPT + 99 others); Mon, 24 Jan 2022 17:14:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1448991AbiAXV16 (ORCPT ); Mon, 24 Jan 2022 16:27:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E862C01D7EE; Mon, 24 Jan 2022 12:19:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B88E8B8121C; Mon, 24 Jan 2022 20:19:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6CCFC340E5; Mon, 24 Jan 2022 20:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055539; bh=f4qv9+XoMJz7jvZPqwNvE9ROL1hpgoLQm93jE0hJKBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TMSWFwYDe+uZrSplUuuqpxFvVc7wi5sTov2WuiYgzdnJ8reU0iw04CwpQHvYKc6d4 ItPfvuj/Z5gYVDo/IeWCotp2nK+yVlRjuvtBUOjyG616VBc2Fw4QQkqu8LM+tkZHwC bA5lXuHi29aCV07Iey3rN6yFegKfOg5WpFjG+JOY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anilkumar Kolli , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 152/846] ath11k: Use host CE parameters for CE interrupts configuration Date: Mon, 24 Jan 2022 19:34:29 +0100 Message-Id: <20220124184106.237408110@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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: Anilkumar Kolli [ Upstream commit b689f091aafd1a874b2f88137934276ab0fca480 ] CE interrupt configuration uses host ce parameters to assign/free interrupts. Use host ce parameters to enable/disable interrupts. This patch fixes below BUG, BUG: KASAN: global-out-of-bounds in 0xffffffbffdfb035c at addr ffffffbffde6eeac Read of size 4 by task kworker/u8:2/132 Address belongs to variable ath11k_core_qmi_firmware_ready+0x1b0/0x5bc [ath11k] OOB is due to ath11k_ahb_ce_irqs_enable() iterates ce_count(which is 12) times and accessing 12th element in target_ce_config (which has only 11 elements) from ath11k_ahb_ce_irq_enable(). With this change host ce configs are used to enable/disable interrupts. Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00471-QCAHKSWPL_SILICONZ-1 Fixes: 967c1d1131fa ("ath11k: move target ce configs to hw_params") Signed-off-by: Anilkumar Kolli Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/1637249558-12793-1-git-send-email-akolli@codeaurora.org Signed-off-by: Sasha Levin --- drivers/net/wireless/ath/ath11k/ahb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/ahb.c b/drivers/net/wireless/ath/ath11k/ahb.c index 8c9c781afc3e5..096c502cce387 100644 --- a/drivers/net/wireless/ath/ath11k/ahb.c +++ b/drivers/net/wireless/ath/ath11k/ahb.c @@ -206,13 +206,13 @@ static void ath11k_ahb_clearbit32(struct ath11k_base *ab, u8 bit, u32 offset) static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) { - const struct ce_pipe_config *ce_config; + const struct ce_attr *ce_attr; - ce_config = &ab->hw_params.target_ce_config[ce_id]; - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) + ce_attr = &ab->hw_params.host_ce_config[ce_id]; + if (ce_attr->src_nentries) ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_ADDRESS); - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { + if (ce_attr->dest_nentries) { ath11k_ahb_setbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); ath11k_ahb_setbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, CE_HOST_IE_3_ADDRESS); @@ -221,13 +221,13 @@ static void ath11k_ahb_ce_irq_enable(struct ath11k_base *ab, u16 ce_id) static void ath11k_ahb_ce_irq_disable(struct ath11k_base *ab, u16 ce_id) { - const struct ce_pipe_config *ce_config; + const struct ce_attr *ce_attr; - ce_config = &ab->hw_params.target_ce_config[ce_id]; - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_OUT) + ce_attr = &ab->hw_params.host_ce_config[ce_id]; + if (ce_attr->src_nentries) ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_ADDRESS); - if (__le32_to_cpu(ce_config->pipedir) & PIPEDIR_IN) { + if (ce_attr->dest_nentries) { ath11k_ahb_clearbit32(ab, ce_id, CE_HOST_IE_2_ADDRESS); ath11k_ahb_clearbit32(ab, ce_id + CE_HOST_IE_3_SHIFT, CE_HOST_IE_3_ADDRESS); -- 2.34.1