Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2558012rwb; Mon, 3 Oct 2022 02:31:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PAazXYzuuwOQ2BL/w4X2kg4sALCySlQpwX3vexQLtcrmnT7/8QsMJWoj+6Gqj+CvKUlhc X-Received: by 2002:a05:6402:350a:b0:452:8c84:8b with SMTP id b10-20020a056402350a00b004528c84008bmr18101593edd.93.1664789514148; Mon, 03 Oct 2022 02:31:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664789514; cv=none; d=google.com; s=arc-20160816; b=DzyybfxCsXatkJo4rl1clK0etiYrVLpd2w5LHxxZ+xiRyCa+JsWkx5TfjcZ3PddcIK CYkp2rS2YxuiIYhA7QzBzHQx4Zz3lFdnsKzMddcvuUUjOTdOcibpNIvzrQQFQfxPK8GZ figHyl82+59KWcGpIifSWCMZ1/y2SCoFM40ZQMQpi26KyCdJR6WEYy20vFmj4ivDDZXL 61mQdiOcOqkshi/dLL55d1GQTtzBAEQaHpJ8Q9stYtEG9Tni+RQrMxlI8nhVm254fhC5 PfuJrU5iUPOSkgQUqtyM0mD4HkEnajkHmFMXLcBgjmgFqZOqgqkK7cLVp3rg1EGtSgnb Odag== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=SNMppGXILPRmAUGOgbtHH6mka3pq7302+CIsjfv+mvU=; b=Wu0hVibCmzUXFIugSgequ9c32NpnHrrFBYGOzyYL2b/obqFk6qBiBzs2G4E78/GrQJ omXOnd269XiUoiu0bh8ANQ728jNrXeAONZzq+nqgFNdJzUBGzfNqoZE0MtTiGqKCzq7q l1hg9zeeXYl9ro65jOC49t9nycj/8e66z09eyhUeIzk87pudtgEHRBS8zDCVvamYK/dC jSemzeO9fEDNba9s9l9TDchav8Fjge0Racm45R7Z615dmNq1KyAn/OJnt/zNn15vXLln nwoKJ8T/JEhbwL+6Oe7aQ5cA0ODd7+lgNb0S9S4BzFMG+0IZYxfCmO1WxzI/qUN0b4xk OEqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b="j/8XpG/v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sa23-20020a1709076d1700b0073064d1c27bsi8198903ejc.500.2022.10.03.02.31.26; Mon, 03 Oct 2022 02:31:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@yandex.ru header.s=mail header.b="j/8XpG/v"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbiJCJSU (ORCPT + 99 others); Mon, 3 Oct 2022 05:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229501AbiJCJSS (ORCPT ); Mon, 3 Oct 2022 05:18:18 -0400 Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [IPv6:2a02:6b8:0:801:2::102]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0845F10540 for ; Mon, 3 Oct 2022 02:18:14 -0700 (PDT) Received: from myt6-efff10c3476a.qloud-c.yandex.net (myt6-efff10c3476a.qloud-c.yandex.net [IPv6:2a02:6b8:c12:13a3:0:640:efff:10c3]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 3FA244BE8DF0; Mon, 3 Oct 2022 12:12:23 +0300 (MSK) Received: by myt6-efff10c3476a.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 0vVcFmtQu1-CLhOiAOp; Mon, 03 Oct 2022 12:12:22 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1664788342; bh=SNMppGXILPRmAUGOgbtHH6mka3pq7302+CIsjfv+mvU=; h=Message-Id:Date:Cc:Subject:To:From; b=j/8XpG/vRJ95g7cR8cjmCTuWByl5baHB+IvPMFdyNoGKi0RQvsKRyuux/SOyt4x32 4n6/2gVSNBb0fGNHqwidEv54SW8fN6kWRfbEC4tn4qEN34jMYZM7tmpz9gdjFzhOro 2uSlZnyJIgRf3TyFmSr0KQ1wFgYXQBYZ1vujIEWc= Authentication-Results: myt6-efff10c3476a.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru From: Peter Kosyh To: Kalle Valo Cc: Peter Kosyh , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ath10k: Check return value of ath10k_get_arvif in ath10k_wmi_event_tdls_peer Date: Mon, 3 Oct 2022 12:12:17 +0300 Message-Id: <20221003091217.322598-1-pkosyh@yandex.ru> X-Mailer: git-send-email 2.37.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return value of a function 'ath10k_get_arvif' is dereferenced without checking for null in ath10k_wmi_event_tdls_peer, but it is usually checked for this function. Make ath10k_wmi_event_tdls_peer do check retval of ath10k_get_arvif. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Peter Kosyh --- drivers/net/wireless/ath/ath10k/wmi-tlv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c index 876410a47d1d..1f2c37c642ff 100644 --- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c +++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c @@ -585,6 +585,11 @@ static void ath10k_wmi_event_tdls_peer(struct ath10k *ar, struct sk_buff *skb) goto exit; } arvif = ath10k_get_arvif(ar, __le32_to_cpu(ev->vdev_id)); + if (!arvif) { + ath10k_warn(ar, "no vif for vdev_id %d found\n", + __le32_to_cpu(ev->vdev_id)); + goto exit; + } ieee80211_tdls_oper_request( arvif->vif, station->addr, NL80211_TDLS_TEARDOWN, -- 2.37.0