Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp340449rbe; Thu, 29 Feb 2024 00:42:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXEpiAHyrfN4dI3Tm0emMwAINeAscb+NHVvQ6ybZ9vn5M/ZxOjyks8tMp/LeCorKAT4TwC7IxBNOTy8y3q7vQo7442egxh7hz2bATFpIQ== X-Google-Smtp-Source: AGHT+IEfrClHVx08sbi7CLDlLWcwjkVU1XodnCnfJj75yLzRcDOI5EvPohhDOl31XYG2i4O1Tzms X-Received: by 2002:a81:91c3:0:b0:609:7575:7861 with SMTP id i186-20020a8191c3000000b0060975757861mr373606ywg.8.1709196165068; Thu, 29 Feb 2024 00:42:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709196165; cv=pass; d=google.com; s=arc-20160816; b=hjkgVVE2UvX6voo7aNxrUrqhZXHJfeFNcfdEfKDmFF85NYO25QER/Ox7wZzJ76yTnn EHaXAy2xLKzvQ1Utf10T0ILiP95mQaB689RyV5PNFirEPcwn6D7QuWerg0ThX/kPhQV0 +mbRZPuupFETdrI4RlU2o9Rx0D4soCNNHux6Nb2kPrk917e+zwX9keCf+UYHeWht3tze 2eInF1Q/LIS3QNJl2/fy2o/xZSK6qJtQqzk9BHR2KaHGTgntnQZ/5f1fTNUVG6LuTslv HF2SAnaOHWwYx9geRW6nN4v9+Cp7Pcads2W0SBe3rZCWY1utJwu55Trz9SV3cPsd4OPR 4TEQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0Ttr1Rc6LQgnqCWP+1fX+y357g9rrnweJwnKxC38lcw=; fh=MdD7IUvVsaMPmvBARkkiVfly5jshOwjAWzuTwtDzbg0=; b=VBlaiP9ps1CbcyyfkcGMBMoNuDRVugSOZxOSoMMr0wShrU+bq+KP1k0C6MNgt0SDOn pE7aHQDwb6nQ4yBuf4SYY5W5PCKcIKnqeqJs+T/XFmJp7JczZJePRK1mFjf4xceJHUIT 7B89cWlvOYoLUtZDO/f0I6UZjJSpDbt5iPsUOakMCJtrMFHta4WrDwnDWHFM7mTD3gQz ssGzINjnEd1DwHAcQtjpKf4IuaHRfbl78uHIPEUJ6xS1i7xmeBxfcYbnSMfAz6DEvlVo dchFzjR0KAWoIKx/wMevCbKwkLVKbpNPbEVLcH8+A6ojFAFkqP9wZU0zq4/HtK+ch6FE 8+rA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=fPcJytgm; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-wireless+bounces-4241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l22-20020a637016000000b005dc4b0e5f57si970486pgc.804.2024.02.29.00.42.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 00:42:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b=fPcJytgm; arc=pass (i=1 spf=pass spfdomain=yandex.ru dkim=pass dkdomain=yandex.ru dmarc=pass fromdomain=yandex.ru); spf=pass (google.com: domain of linux-wireless+bounces-4241-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BA153284C39 for ; Thu, 29 Feb 2024 08:42:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AAA650A6D; Thu, 29 Feb 2024 08:41:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="fPcJytgm" X-Original-To: linux-wireless@vger.kernel.org Received: from forward103c.mail.yandex.net (forward103c.mail.yandex.net [178.154.239.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A936143AD5 for ; Thu, 29 Feb 2024 08:41:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.214 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196068; cv=none; b=CWUfhWaMCl883W4D3sgRREHjq42rffrRfKn6g7N31SvZcR/bovlp+J3CXebsv8gsSxha6us+h+QM8OoIzpHbTz+UB3v9DCze/hiV3y4i8v/O44ib1bVwxif4gaf9Af56Wsw6E9SdSCE+1ZF4DoMWHRLBoO7KNE0hKxFHeY/8Eu4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709196068; c=relaxed/simple; bh=tq0wf6eEo8lPoEY7Vg8wPwEQ2+/zhBI1SDEB7FHWoBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gdnuUEPfMuwV7Uoyw1CaYzLOs/NHsvJdMJDMSlSDJ0QuWC+8GDJZJdHx+0Gf5yXzGZ9x/LPCNrz/U4C6N4TF+1HbdavTGRbsMAvxjYPsgEY3At8oFwjnjJTC3Q/rYSA+E/yUn00IEgS/7ICOUhFiSDno0nsrb9lv2SbR/LDLl74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=fPcJytgm; arc=none smtp.client-ip=178.154.239.214 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Received: from mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net [IPv6:2a02:6b8:c14:6e01:0:640:627f:0]) by forward103c.mail.yandex.net (Yandex) with ESMTPS id 129A860B62; Thu, 29 Feb 2024 11:40:57 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id teVSqmLJiW20-6Zz5L67T; Thu, 29 Feb 2024 11:40:56 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1709196056; bh=0Ttr1Rc6LQgnqCWP+1fX+y357g9rrnweJwnKxC38lcw=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=fPcJytgmrLEdj4b4RUjGE1QFf2MbLbirXX7ySfLWviSpH9d84PMpWcv4JDZrKDeI/ NlE9eu7RmuIm8isWTbIH04HFEcQTM7NKeK4WbMMPmlWIBXqjjbWpNaJK/wvz0efAh+ aSaN3+xDLSrJd/2Kr1/STmhI0dLvEVz1fLSM4vfE= Authentication-Results: mail-nwsmtp-smtp-production-main-63.sas.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Jeff Johnson Cc: Baochen Qiang , Kalle Valo , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, lvc-project@linuxtesting.org, Dmitry Antipov Subject: [PATCH 1/3] [v2] wifi: ath11k: use ath11k_mac_get_ar_by_pdev_id() consistently Date: Thu, 29 Feb 2024 11:40:29 +0300 Message-ID: <20240229084031.51957-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.44.0 In-Reply-To: <788f1df8-64e1-4b3c-ae8e-00c67be1c3de@quicinc.com> References: <788f1df8-64e1-4b3c-ae8e-00c67be1c3de@quicinc.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Since 'ath11k_mac_get_ar_by_pdev_id()' can return NULL, check the return value in 'ath11k_wmi_tlv_rssi_chain_parse()' as well as in 'ath11k_wmi_tlv_fw_stats_data_parse()', and return -EINVAL in case of error. Compile tested only. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Dmitry Antipov --- v2: aggregate to the series --- drivers/net/wireless/ath/ath11k/wmi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c index 34ab9631ff36..2d93e4e78a37 100644 --- a/drivers/net/wireless/ath/ath11k/wmi.c +++ b/drivers/net/wireless/ath/ath11k/wmi.c @@ -6498,6 +6498,12 @@ static int ath11k_wmi_tlv_rssi_chain_parse(struct ath11k_base *ab, rcu_read_lock(); ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); + if (!ar) { + ath11k_warn(ab, "%s: invalid pdev_id %d\n", + __func__, ev->pdev_id); + ret = -EINVAL; + goto exit; + } stats->stats_id = WMI_REQUEST_RSSI_PER_CHAIN_STAT; ath11k_dbg(ab, ATH11K_DBG_WMI, @@ -6570,6 +6576,12 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab, rcu_read_lock(); ar = ath11k_mac_get_ar_by_pdev_id(ab, ev->pdev_id); + if (!ar) { + ath11k_warn(ab, "%s: invalid pdev_id %d\n", + __func__, ev->pdev_id); + ret = -EINVAL; + goto exit; + } for (i = 0; i < ev->num_pdev_stats; i++) { const struct wmi_pdev_stats *src; -- 2.44.0