From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 73C3E1D07BA; Thu, 17 Apr 2025 18:29:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744914580; cv=none; b=kBDkFEf7gGO9BrdnIWrwEYbRoC7svMCBnsWlZiFJsMh1H16LKkm0ARvHQU5hizZ/J7t/+uvPKujNYNX6UOuAfN6Wyy/8DwvJrq6YER4x0I6nOWiNX6mWTY3FGhvbAUZfr3L04psaaxNy3QTM2lZhaGn4zDamsfwQ8jogCkq7LQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744914580; c=relaxed/simple; bh=+MzIUEUPngTSBEZBtOpKZ2or7MFtFgSQkp8ApPKsg40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AhiSnDniB5V+LTtYUrh4KFUwCUKGvNSPGeK8axmQUNzPQL/c5MgcEQGQLDyBc+v2/DZXAMPfOVfsdPHqOfSLdsRpcnwnqOX1ckNE1ScqviXIerx83UjnS/1SVC7Vs1Egm6ni8HSOFzFnWKRU/h+KWocbN4Tu1g5s2MuyQlYfmaA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eVJnvCKM; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eVJnvCKM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06A0CC4CEE7; Thu, 17 Apr 2025 18:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744914580; bh=+MzIUEUPngTSBEZBtOpKZ2or7MFtFgSQkp8ApPKsg40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eVJnvCKM2pbViTngw9KiAoPOytlxU9Ro/3yp7VAC8FlK4pK7mp3RuU96Vd21gsQT4 nyD2t1ZSgWEBT2tAA3n4y/9Zw8sG3inBmfIQZg1msDsWt9Fo8eOa2k44kIXGNUvsXO 7VINnvyeK3egNUYZh2d9jF/lFj5kbjzZtFa8jHSE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qingfang Deng , Jacob Keller , Jakub Kicinski Subject: [PATCH 6.13 262/414] net: stmmac: Fix accessing freed irq affinity_hint Date: Thu, 17 Apr 2025 19:50:20 +0200 Message-ID: <20250417175121.967125071@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175111.386381660@linuxfoundation.org> References: <20250417175111.386381660@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Qingfang Deng commit c60d101a226f18e9a8f01bb4c6ca2b47dfcb15ef upstream. The cpumask should not be a local variable, since its pointer is saved to irq_desc and may be accessed from procfs. To fix it, use the persistent mask cpumask_of(cpu#). Cc: stable@vger.kernel.org Fixes: 8deec94c6040 ("net: stmmac: set IRQ affinity hint for multi MSI vectors") Signed-off-by: Qingfang Deng Reviewed-by: Jacob Keller Link: https://patch.msgid.link/20250318032424.112067-1-dqfext@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3570,7 +3570,6 @@ static int stmmac_request_irq_multi_msi( { struct stmmac_priv *priv = netdev_priv(dev); enum request_irq_err irq_err; - cpumask_t cpu_mask; int irq_idx = 0; char *int_name; int ret; @@ -3699,9 +3698,8 @@ static int stmmac_request_irq_multi_msi( irq_idx = i; goto irq_error; } - cpumask_clear(&cpu_mask); - cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); - irq_set_affinity_hint(priv->rx_irq[i], &cpu_mask); + irq_set_affinity_hint(priv->rx_irq[i], + cpumask_of(i % num_online_cpus())); } /* Request Tx MSI irq */ @@ -3724,9 +3722,8 @@ static int stmmac_request_irq_multi_msi( irq_idx = i; goto irq_error; } - cpumask_clear(&cpu_mask); - cpumask_set_cpu(i % num_online_cpus(), &cpu_mask); - irq_set_affinity_hint(priv->tx_irq[i], &cpu_mask); + irq_set_affinity_hint(priv->tx_irq[i], + cpumask_of(i % num_online_cpus())); } return 0;