Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp336863lqg; Fri, 1 Mar 2024 06:43:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWqiILkhIgWZPsJUZpxWSyEfjLV+ARTiQx5pFlZ7XmbPBM/NhY4rghbEMVF8mL/+6gV2Dy6LYxDD43ZRslCNecDsC9nf4R5QBNUEpuvGg== X-Google-Smtp-Source: AGHT+IFFAKTeCW+UhDNTrTP4XkaFCNLTUjJm93QhhlPaXbGVdYHL/t5ZNZFm0+6IdjiNaJgeXPFz X-Received: by 2002:ac8:5d91:0:b0:42e:ab25:9526 with SMTP id d17-20020ac85d91000000b0042eab259526mr1793040qtx.67.1709304235960; Fri, 01 Mar 2024 06:43:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709304235; cv=pass; d=google.com; s=arc-20160816; b=o5ztwdvpTtZjyOV0xA8w9DPBvdv6NksQiHSmCK0UgINWdgaLUgEr/+O8Rr+RUo5/KD ATWk5YNsYHSDe1des1PQ9+IzA6OArnEbODa75P83tIHd718Us2eO75bMTpqNnb5CjF9a lnHSw4CUyivRV1bDvxQZ08UF/tjPqqyLmhKhKfSBpu1959SFZiHZVeIjJ4juW/HPDld1 EzGVZ5rSfQ6vezkaaMWMiS9lwT9fuJfIxbs7yBzv7xtwsKZsknDJH7a3BQNRd2Z9OH4u 3yDH62LhMzaOHdfzBFhEgSIe7X4cznKy8xaEfGZEwJqwk3hiHdb6fQfBsk0LVEIP65cd ZGDA== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=zyCBaXUAE5a5edh6bvFxtATvJHIPBJYNND68hadfLf0=; fh=RurCInEC3Vt9TXbKiVNOp6HfBtwWFbCWekF4s3BZTyE=; b=lIrG3lEeeNS7R0NLv54kurtYubIKNrYcnvVryQeRF026B+0NJ3UriWfxc0F4HEGKF4 eCrZufsDAfTpkoIZk1gtygnEackB4r5oadcNzwNHM0rn3s4X3zVXrTmBYQvty0SzUoiG 2DVWTL+O+KVOxN9A0OZgv1/CF/AVWLcDcnhj+xKs9zJNIpDbSjQDtW96ApKdWEnl2KUM K3ssVw9mV9lWiLbs0vgpCbSVb3JO9t15mIn9YLjUyRb170QJ4lE62z3GURtpT4e+0c2w EQRr56AXwfqLPvl83BmXGttCmBppLTlEIZecrYdrCKQM/ZSZjLXB6CZAXREnBu4go5e2 a7dQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=xxNTTc97; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-wireless+bounces-4295-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y16-20020a05622a121000b0042e770d48dfsi4038745qtx.35.2024.03.01.06.43.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 06:43:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4295-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=xxNTTc97; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-wireless+bounces-4295-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4295-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7F3851C20E4C for ; Fri, 1 Mar 2024 14:43:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 960BC38DC3; Fri, 1 Mar 2024 14:43:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="xxNTTc97" X-Original-To: linux-wireless@vger.kernel.org Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (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 0D25023DE; Fri, 1 Mar 2024 14:43:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709304232; cv=none; b=JwvZxssYQxsBiA9JeswHDZY/eDCLjxfPk5aUL/tx2dwZy5D4tNIikDogMJS0EBfdtr2Kh6QfTV1KUmHesPorLXbPe2UNBIIcDr4I52t0shU5pZBdT/isbJdtRjxEnHahCt4ylvvBlXLjrrWkmTUAYPvWZwNWjX5HrlrIvhcL+KU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709304232; c=relaxed/simple; bh=g/5FdFmANw8vfKyQblOhb3dPtLnfPxgu5rTqDPLM/k0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=N0YwpXMTVpndVfdr3MT5PaLTfpjWhMaYtr0U/Ml+huNrkJO9XZvJ5DzfR1RgEy6NCZvjQR2US6saFSAo3ft3bDUacpQz7or+qeWdABv6nka7xPeFXsqDqLOJZ7usE7ooiA99qzXNkGzI7C8mFKZgti1mRQa42T+zL+UwNN0fu/M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=xxNTTc97; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1709304229; bh=g/5FdFmANw8vfKyQblOhb3dPtLnfPxgu5rTqDPLM/k0=; h=From:To:Cc:Subject:Date:From; b=xxNTTc97xWYp4JHtRwbQppAyuiFMXatZr52S8x9U/4TFPZ1ascmVK8vAU4mjYEzBq Ykt+7E/MR8BSvG9PeoGYfiaOMmtqXUhN/4DXG6vrhD+soagLQbiuEmmdy+4r0lrAZO RAkqLMeNDa2bZHflQJJ6NLEfW2xGoyaR/9g0V7Ag1l3STfFDbmhVYpNDer3cyPAwAX pxzr8htRsrWFkVP7HF37kkPIkduT3wUHBMbuyru+2XH4Qwl94k/OkkvE6cjznHaxCa be6nP4OuhB7n7xer/eWCg3+KKmNflNZMbl9Xo6uoH8Ej7o265Ya7KFGXe+NvmujkLp 7TQEbUwPHkSdg== Received: from localhost.localdomain (broslavsky.collaboradmins.com [68.183.210.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madrid.collaboradmins.com (Postfix) with ESMTPSA id A6DB837803EE; Fri, 1 Mar 2024 14:43:42 +0000 (UTC) From: Muhammad Usama Anjum To: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno Cc: Muhammad Usama Anjum , kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH] wifi: mt76: connac: check for null before dereferencing Date: Fri, 1 Mar 2024 19:44:06 +0500 Message-Id: <20240301144406.2808307-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The wcid can be NULL. It should be checked for validity before dereferencing it to avoid crash. Fixes: 098428c400ff ("wifi: mt76: connac: set correct muar_idx for mt799x chipsets") Signed-off-by: Muhammad Usama Anjum --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index af0c2b2aacb00..7af60eebe517a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -283,7 +283,7 @@ __mt76_connac_mcu_alloc_sta_req(struct mt76_dev *dev, struct mt76_vif *mvif, }; struct sk_buff *skb; - if (is_mt799x(dev) && !wcid->sta) + if (is_mt799x(dev) && wcid && !wcid->sta) hdr.muar_idx = 0xe; mt76_connac_mcu_get_wlan_idx(dev, wcid, &hdr.wlan_idx_lo, -- 2.39.2