[PATCH net-next v2 1/2] net/iucv: Avoid explicit cpumask var allocation on stack

Dawei Li
2024-03-31T16:41:25Z

net/iucv/iucv.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index a4ab615ca3e3..5e37a8ceebcb 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -520,7 +520,7 @@ static void iucv_setmask_mp(void)
*/
static void iucv_setmask_up(void)
{
- cpumask_t cpumask;
+ static cpumask_t cpumask;
int cpu;

/* Disable all cpu but the first in cpu_irq_cpumask. */
@@ -628,23 +628,33 @@ static int iucv_cpu_online(unsigned int cpu)

static int iucv_cpu_down_prep(unsigned int cpu)
{
- cpumask_t cpumask;
+ cpumask_var_t cpumask;
+ int ret = 0;

if (!iucv_path_table)
return 0;

- cpumask_copy(&cpumask, &iucv_buffer_cpumask);
- cpumask_clear_cpu(cpu, &cpumask);
- if (cpumask_empty(&cpumask))
+ if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
+ return -ENOMEM;
+
+ cpumask_copy(cpumask, &iucv_buffer_cpumask);
+ cpumask_clear_cpu(cpu, cpumask);
+ if (cpumask_empty(cpumask)) {
/* Can't offline last IUCV enabled cpu. */
- return -EINVAL;
+ ret = -EINVAL;
+ goto __free_cpumask;
+ }

iucv_retrieve_cpu(NULL);
if (!cpumask_empty(&iucv_irq_cpumask))
- return 0;
+ goto __free_cpumask;
+
smp_call_function_single(cpumask_first(&iucv_buffer_cpumask),
iucv_allow_cpu, NULL, 1);
- return 0;
+
+__free_cpumask:
+ free_cpumask_var(cpumask);
+ return ret;
}

/**
--
2.27.0

X-sender: <netdev+bounces-83538-steffen.klassert=secunet.com@vger.kernel.org>
X-Receiver: <steffen.klassert@secunet.com> ORCPT=rfc822;steffen.klassert@secunet.com NOTIFY=NEVER; X-ExtendedProps=BQBYABcASgAAAPDFCS25BAlDktII2g02frhDTj1LbGFzc2VydCBTdGVmZmVuL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HeloDomain: b.mx.secunet.com
X-ExtendedProps: BQBjAAoAm3AFfe5Q3AgFAGEACAABAAAABQA3AAIAAA8APAAAAE1pY3Jvc29mdC5FeGNoYW5nZS5UcmFuc3BvcnQuTWFpbFJlY2lwaWVudC5Pcmdhbml6YXRpb25TY29wZREAAAAAAAAAAAAAAAAAAAAAAAUASQACAAEFAAQAFCABAAAAHAAAAHN0ZWZmZW4ua2xhc3NlcnRAc2VjdW5ldC5jb20FAAYAAgABDwAqAAAATWljcm9zb2Z0LkV4Y2hhbmdlLlRyYW5zcG9ydC5SZXN1Ym1pdENvdW50BwABAAAADwAJAAAAQ0lBdWRpdGVkAgABBQACAAcAAQAAAAUAAwAHAAAAAAAFAAUAAgABBQBiAAoAYwAAAOyKAAAFAGQADwADAAAASHViBQApAAIAAQ==
X-Source: SMTP:Default MBX-ESSEN-02
X-SourceIPAddress: 62.96.220.37
X-EndOfInjectedXHeaders: 13156
Received: from cas-essen-02.secunet.de (10.53.40.202) by
mbx-essen-02.secunet.de (10.53.40.198) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.1.2507.37; Sun, 31 Mar 2024 07:37:07 +0200
Received: from b.mx.secunet.com (62.96.220.37) by cas-essen-02.secunet.de
(10.53.40.202) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37 via Frontend
Transport; Sun, 31 Mar 2024 07:37:07 +0200
Received: from localhost (localhost [127.0.0.1])
by b.mx.secunet.com (Postfix) with ESMTP id B85AA20199
for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 07:37:07 +0200 (CEST)
X-Virus-Scanned: by secunet
X-Spam-Flag: NO
X-Spam-Score: -4.951
X-Spam-Level:
X-Spam-Status: No, score=-4.951 tagged_above=-999 required=2.1
tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=unavailable autolearn_force=no
Received: from b.mx.secunet.com ([127.0.0.1])
by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id W5t16-SzPzNP for <steffen.klassert@secunet.com>;
Sun, 31 Mar 2024 07:37:04 +0200 (CEST)
Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=139.178.88.99; helo=sv.mirrors.kernel.org; envelope-from=netdev+bounces-83538-steffen.klassert=secunet.com@vger.kernel.org; receiver=steffen.klassert@secunet.com
DKIM-Filter: OpenDKIM Filter v2.11.0 b.mx.secunet.com C26CF20310
Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by b.mx.secunet.com (Postfix) with ESMTPS id C26CF20310
for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 07:37:03 +0200 (CEST)
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 CCA95282445
for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 05:37:01 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id D7EEF6FB2;
Sun, 31 Mar 2024 05:36:53 +0000 (UTC)
X-Original-To: netdev@vger.kernel.org
Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56])
(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 71F9D6FA7;
Sun, 31 Mar 2024 05:36:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.207.22.56
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1711863413; cv=none; b=RpVDbX2JD0/RlW8D3gN7OWsadmc/olonOAvagvgCKlgPh8iwqleFOAs1g1tsHRmtm5UUYluM5mA1wYn26M5NeINJKyIg90zg4vqzAdudbbmXgcs05AQmoZX3s7pqWOyEbC4QtOoms2WPtUhwcYKE/2gGCjzh8Ce4wGf3gL3KJI8=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1711863413; c=relaxed/simple;
bh=cRT3X+uLWIo/WDT/dysE7g0AVNehkJ5rdYqVsI+vjX4=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=sJGQalf5ygsLz6W7crwPcqJPg9D2iGQDLglH0ceLy/J91sAwjpOeLVrpyKsKv+GF3c/o5LJ9MTIYYGxWiDZdwZrtpK4DnTjYj/bwd04ljxHUXXks+AJ62V2K+q6ynlRDjwUtctZuSI/7xszZJI9mjsIOksy7n6En4OXN4lYeN9g=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn; spf=pass smtp.mailfrom=shingroup.cn; arc=none smtp.client-ip=54.207.22.56
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shingroup.cn
X-QQ-mid: bizesmtp87t1711863353tvqruomb
X-QQ-Originating-IP: dHu89vOsfyXlaQKZF86cBB1XYRxM3aKc0t7f88USl8g=
Received: from localhost ( [112.0.147.175])
by bizesmtp.qq.com (ESMTP) with
id ; Sun, 31 Mar 2024 13:35:52 +0800 (CST)
X-QQ-SSF: 01400000000000704000000A0000000
X-QQ-FEAT: rZJGTgY0+YOuhoc1+jgTQzFXybo6WpkwHmAznXexq7mNnvmJOrZ22rJCyRlxA
yv+DUYrg83tauZiFD4e5OeolzNLxCkYZAI3ridWwMnx2JQecfKQBp6G915QB7WwOeONSCAQ
yiiu0Z+ri/Nw7546cTU5FunYzRvLQVeaNQXN84uh1FHxLo6fpmfcrxm7/+sMZdYHa3cAaRl
lTYuZWrjb5rQtysFSnufhD17smjbr9Zod6O8MaB8Un+YnXkUvQCTJjP7wxCo8r0n+rP7Omt
ETATyyanGMCSnkBeXJDPkdGNQF1RQgjq6q60WhxSBKe90UnQzoh9rQ6lzMDcGqqJm5fJaTq
T82qGnoMMUZejzj1HUiSxMd5lxp71G2bssZRY5kxGdGRmMmri9sTkshPuxG6SH3lpBNpj3e
X-QQ-GoodBg: 2
X-BIZMAIL-ID: 4506703939604469898
From: Dawei Li <dawei.li@shingroup.cn>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <ioana.ciornei@nxp.com>, <wintera@linux.ibm.com>,
<twinkler@linux.ibm.com>
CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-s390@vger.kernel.org>, Dawei Li <dawei.li@shingroup.cn>
Subject: [PATCH net-next v2 1/2] net/iucv: Avoid explicit cpumask var allocation on stack
Date: Sun, 31 Mar 2024 13:34:40 +0800
Message-ID: <20240331053441.1276826-2-dawei.li@shingroup.cn>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20240331053441.1276826-1-dawei.li@shingroup.cn>
References: <20240331053441.1276826-1-dawei.li@shingroup.cn>
Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
List-Id: <netdev.vger.kernel.org>
List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-QQ-SENDSIZE: 520
Feedback-ID: bizesmtp:shingroup.cn:qybglogicsvrgz:qybglogicsvrgz5a-1
Return-Path: netdev+bounces-83538-steffen.klassert=secunet.com@vger.kernel.org
X-MS-Exchange-Organization-OriginalArrivalTime: 31 Mar 2024 05:37:07.8102
(UTC)
X-MS-Exchange-Organization-Network-Message-Id: 7ef23b67-34b2-4e2d-6d56-08dc51449ae5
X-MS-Exchange-Organization-OriginalClientIPAddress: 62.96.220.37
X-MS-Exchange-Organization-OriginalServerIPAddress: 10.53.40.202
X-MS-Exchange-Organization-Cross-Premises-Headers-Processed: cas-essen-02.secunet.de
X-MS-Exchange-Organization-OrderedPrecisionLatencyInProgress: LSRV=mbx-essen-02.secunet.de:TOTAL-HUB=17530.414|SMR=0.140(SMRDE=0.005|SMRC=0.135(SMRCL=0.101|X-SMRCR=0.135))|CAT=0.081(CATOS=0.001
|CATRESL=0.030(CATRESLP2R=0.018)|CATORES=0.044(CATRS=0.044(CATRS-Transport
Rule Agent=0.001 (X-ETREX=0.001)|CATRS-Index Routing
Agent=0.041))|CATORT=0.003(CATRT=0.003(CATRT-Journal Agent=0.002
)))|QDM=6662.984|SMSC=0.180(X-SMSDR=0.011)|SMS=1.932(SMSMBXD-INC=1.860)|QDM=10865.222
|UNK=0.001|CAT=0.012(CATRESL=0.009(CATRESLP2R=0.001)|CATORES=0.001(CATRS=0.001));2024-03-31T10:29:18.270Z
Content-Type: text/plain
X-MS-Exchange-Forest-ArrivalHubServer: mbx-essen-02.secunet.de
X-MS-Exchange-Organization-AuthSource: cas-essen-02.secunet.de
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-FromEntityHeader: Internet
X-MS-Exchange-Organization-OriginalSize: 8067
X-MS-Exchange-Organization-HygienePolicy: Standard
X-MS-Exchange-Organization-MessageLatency: SRV=cas-essen-02.secunet.de:TOTAL-FE=0.045|SMR=0.011(SMRPI=0.008(SMRPI-FrontendProxyAgent=0.008))|SMS=0.035
X-MS-Exchange-Organization-Recipient-Limit-Verified: True
X-MS-Exchange-Organization-TotalRecipientCount: 1
X-MS-Exchange-Organization-Rules-Execution-History: 0b0cf904-14ac-4724-8bdf-482ee6223cf2%%%fd34672d-751c-45ae-a963-ed177fcabe23%%%d8080257-b0c3-47b4-b0db-23bc0c8ddb3c%%%95e591a2-5d7d-4afa-b1d0-7573d6c0a5d9%%%f7d0f6bc-4dcc-4876-8c5d-b3d6ddbb3d55%%%16355082-c50b-4214-9c7d-d39575f9f79b
X-MS-Exchange-Forest-RulesExecuted: mbx-essen-02
X-MS-Exchange-Organization-RulesExecuted: mbx-essen-02
X-MS-Exchange-Forest-IndexAgent-0: AQ0CZW4AATQFAAAPAAADH4sIAAAAAAAEAI1VW3ObVhA+SAgQNo5rJ2
3SPnT7kki2kG+J44mbTjyOnfH4kkxT55VBcJCZYFC5yPG0/Xv9Xd09
gIUknIZBcDi7++337S7o3+XjKIbD9xfHJ++sww+X5wcfT633x8cf/z
g4PH19C595HPKgB/zLKPAdPwU7CCLHTv0ohMgDZ5Rd28lnQx/bsW8P
Ag64n6S28xn8BMIohZg70fU1D13uQuKHDgcEcewQf1nCYRSlPEx9O8
ijDD0a89gLopu+oRv6SZik3HZ7BQ1wIpdDchVlgYtEbuzbBAhkraBh
IQs4+HDSSbqQRiVVbuiFHcjuY+oo9PyhGfIsjTEz4vQg4PbYD4dVfQ
laUz68RSxDv6dEgublVzi4bsyTBEULz4/+MOSuGXmeObh9BW/tG+7D
mQ+/urTqB/6b5ApZxFE26jvhb4ZumqahQ8jTDT9zxuLSd+Bv2N6F9b
nDLA6M2ALPx244V3Y45FjArT0UnvCYhCWd9W4P9sDlAc+fzS6Rc33P
A9McUpc3ZlMOZncM3cemfgH7uT3Y3Xrh2Dt8p99/wXde2nsO5wNnAF
ubm7vPnwsR84iGjozrYN+8AfPF9mbvJaznN9zA4Uh9B8aR7wL5WQlP
RbWvRx3aRP4Aaxt4vdczm3j+hZQgP8qupeVqH3kVtgKqzqXwwJqK3X
0qX7m3sQZv/US8DDhMZIZBlkJ6xbEncZKKCRxllh//aRWIfcGdhO9u
7/W2d2Cd7js7FemUSeih0CgM/JB3sjAR81TSEF2sDXCjm9AaxXxUF/
Ot9ahMeK2dEGOewmvYnCqI70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DEwLDE7UG9zdE
RvY1BhcnNlck9wZXJhdG9yLDExLDA7UG9zdFdvcmRCcmVha2VyRGlh
Z25vc3RpY09wZXJhdG9yLDEwLDI7UG9zdFdvcmRCcmVha2VyRGlhZ2
5vc3RpY09wZXJhdG9yLDExLDA7VHJhbnNwb3J0V3JpdGVyUHJvZHVj ZXIsMjAsMjI=
X-MS-Exchange-Forest-IndexAgent: 1 2357
X-MS-Exchange-Forest-EmailMessageHash: 31D07584
X-MS-Exchange-Forest-Language: en
X-MS-Exchange-Organization-Processed-By-Journaling: Journal Agent

For CONFIG_CPUMASK_OFFSTACK=y kernel, explicit allocation of cpumask
variable on stack is not recommended since it can cause potential stack
overflow.

Instead, kernel code should always use *cpumask_var API(s) to allocate
cpumask var in config-neutral way, leaving allocation strategy to
CONFIG_CPUMASK_OFFSTACK.

Use *cpumask_var API(s) to address it.

Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
---
net/iucv/iucv.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index a4ab615ca3e3..5e37a8ceebcb 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -520,7 +520,7 @@ static void iucv_setmask_mp(void)
*/
static void iucv_setmask_up(void)
{
- cpumask_t cpumask;
+ static cpumask_t cpumask;
int cpu;

/* Disable all cpu but the first in cpu_irq_cpumask. */
@@ -628,23 +628,33 @@ static int iucv_cpu_online(unsigned int cpu)

static int iucv_cpu_down_prep(unsigned int cpu)
{
- cpumask_t cpumask;
+ cpumask_var_t cpumask;
+ int ret = 0;

if (!iucv_path_table)
return 0;

- cpumask_copy(&cpumask, &iucv_buffer_cpumask);
- cpumask_clear_cpu(cpu, &cpumask);
- if (cpumask_empty(&cpumask))
+ if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
+ return -ENOMEM;
+
+ cpumask_copy(cpumask, &iucv_buffer_cpumask);
+ cpumask_clear_cpu(cpu, cpumask);
+ if (cpumask_empty(cpumask)) {
/* Can't offline last IUCV enabled cpu. */
- return -EINVAL;
+ ret = -EINVAL;
+ goto __free_cpumask;
+ }

iucv_retrieve_cpu(NULL);
if (!cpumask_empty(&iucv_irq_cpumask))
- return 0;
+ goto __free_cpumask;
+
smp_call_function_single(cpumask_first(&iucv_buffer_cpumask),
iucv_allow_cpu, NULL, 1);
- return 0;
+
+__free_cpumask:
+ free_cpumask_var(cpumask);
+ return ret;
}

/**
--
2.27.0

X-sender: <linux-kernel+bounces-125959-steffen.klassert=secunet.com@vger.kernel.org>
X-Receiver: <steffen.klassert@secunet.com> ORCPT=rfc822;steffen.klassert@secunet.com; X-ExtendedProps=DwA1AAAATWljcm9zb2Z0LkV4Y2hhbmdlLlRyYW5zcG9ydC5EaXJlY3RvcnlEYXRhLklzUmVzb3VyY2UCAAAFABUAFgACAAAABQAUABEA8MUJLbkECUOS0gjaDTZ+uAUAagAJAAEAAAAAAAAABQAWAAIAAAUAQwACAAAFAEYABwADAAAABQBHAAIAAAUAEgAPAGIAAAAvbz1zZWN1bmV0L291PUV4Y2hhbmdlIEFkbWluaXN0cmF0aXZlIEdyb3VwIChGWURJQk9IRjIzU1BETFQpL2NuPVJlY2lwaWVudHMvY249U3RlZmZlbiBLbGFzc2VydDY4YwUACwAXAL4AAACheZxkHSGBRqAcAp3ukbifQ049REI2LENOPURhdGFiYXNlcyxDTj1FeGNoYW5nZSBBZG1pbmlzdHJhdGl2ZSBHcm91cCAoRllESUJPSEYyM1NQRExUKSxDTj1BZG1pbmlzdHJhdGl2ZSBHcm91cHMsQ049c2VjdW5ldCxDTj1NaWNyb3NvZnQgRXhjaGFuZ2UsQ049U2VydmljZXMsQ049Q29uZmlndXJhdGlvbixEQz1zZWN1bmV0LERDPWRlBQAOABEABiAS9uuMOkqzwmEZDvWNNQUAHQAPAAwAAABtYngtZXNzZW4tMDIFADwAAgAADwA2AAAATWljcm9zb2Z0LkV4Y2hhbmdlLlRyYW5zcG9ydC5NYWlsUmVjaXBpZW50LkRpc3BsYXlOYW1lDwARAAAAS2xhc3NlcnQsIFN0ZWZmZW4FAGwAAgAABQBYABcASgAAAPDFCS25BAlDktII2g02frhDTj1LbGFzc2VydCBTdGVmZmVuLE9VPVVzZXJzLE9VPU1pZ3JhdGlvbixEQz1zZWN1bmV0LERDPWRlBQAMAAIAAAUAJgACAAEFACIADwAxAAAAQXV0b1Jlc3BvbnNlU3VwcHJlc3M6IDANClRyYW5zbWl0SGlzdG9yeTogRmFsc2UNCg8ALwAAAE1pY3Jvc29mdC5FeGNoYW5nZS5UcmFuc3BvcnQuRXhwYW5zaW9uR3JvdXBUeXBlDwAVAAAATWVtYmVyc0dyb3VwRXhwYW5zaW9uBQAjAAIAAQ==
X-CreatedBy: MSExchange15
X-HeloDomain: b.mx.secunet.com
X-ExtendedProps: BQBjAAoAknAFfe5Q3AgFAGEACAABAAAABQA3AAIAAA8APAAAAE1pY3Jvc29mdC5FeGNoYW5nZS5UcmFuc3BvcnQuTWFpbFJlY2lwaWVudC5Pcmdhbml6YXRpb25TY29wZREAAAAAAAAAAAAAAAAAAAAAAAUASQACAAEFAAQAFCABAAAAHAAAAHN0ZWZmZW4ua2xhc3NlcnRAc2VjdW5ldC5jb20FAAYAAgABDwAqAAAATWljcm9zb2Z0LkV4Y2hhbmdlLlRyYW5zcG9ydC5SZXN1Ym1pdENvdW50BwACAAAADwAJAAAAQ0lBdWRpdGVkAgABBQACAAcAAQAAAAUAAwAHAAAAAAAFAAUAAgABBQBiAAoAZAAAAOyKAAAFAGQADwADAAAASHViBQApAAIAAQ8APwAAAE1pY3Jvc29mdC5FeGNoYW5nZS5UcmFuc3BvcnQuRGlyZWN0b3J5RGF0YS5NYWlsRGVsaXZlcnlQcmlvcml0eQ8AAwAAAExvdw==
X-Source: SMTP:Default MBX-ESSEN-02
X-SourceIPAddress: 62.96.220.37
X-EndOfInjectedXHeaders: 13384
Received: from cas-essen-01.secunet.de (10.53.40.201) by
mbx-essen-02.secunet.de (10.53.40.198) with Microsoft SMTP Server
(version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.1.2507.37; Sun, 31 Mar 2024 07:37:14 +0200
Received: from b.mx.secunet.com (62.96.220.37) by cas-essen-01.secunet.de
(10.53.40.201) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37 via Frontend
Transport; Sun, 31 Mar 2024 07:37:14 +0200
Received: from localhost (localhost [127.0.0.1])
by b.mx.secunet.com (Postfix) with ESMTP id AA1D120310
for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 07:37:14 +0200 (CEST)
X-Virus-Scanned: by secunet
X-Spam-Flag: NO
X-Spam-Score: -2.651
X-Spam-Level:
X-Spam-Status: No, score=-2.651 tagged_above=-999 required=2.1
tests=[BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_NONE=-0.0001,
SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=unavailable autolearn_force=no
Received: from b.mx.secunet.com ([127.0.0.1])
by localhost (a.mx.secunet.com [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id 7Tz73JS66gbv for <steffen.klassert@secunet.com>;
Sun, 31 Mar 2024 07:37:13 +0200 (CEST)
Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=147.75.80.249; helo=am.mirrors.kernel.org; envelope-from=linux-kernel+bounces-125959-steffen.klassert=secunet.com@vger.kernel.org; receiver=steffen.klassert@secunet.com
DKIM-Filter: OpenDKIM Filter v2.11.0 b.mx.secunet.com 7034320199
Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [147.75.80.249])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by b.mx.secunet.com (Postfix) with ESMTPS id 7034320199
for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 07:37:13 +0200 (CEST)
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 am.mirrors.kernel.org (Postfix) with ESMTPS id 15A3E1F212E2
for <steffen.klassert@secunet.com>; Sun, 31 Mar 2024 05:37:13 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id CF6C88BE2;
Sun, 31 Mar 2024 05:36:54 +0000 (UTC)
Received: from smtpbgbr2.qq.com (smtpbgbr2.qq.com [54.207.22.56])
(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 71F9D6FA7;
Sun, 31 Mar 2024 05:36:46 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=54.207.22.56
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1711863413; cv=none; b=RpVDbX2JD0/RlW8D3gN7OWsadmc/olonOAvagvgCKlgPh8iwqleFOAs1g1tsHRmtm5UUYluM5mA1wYn26M5NeINJKyIg90zg4vqzAdudbbmXgcs05AQmoZX3s7pqWOyEbC4QtOoms2WPtUhwcYKE/2gGCjzh8Ce4wGf3gL3KJI8=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1711863413; c=relaxed/simple;
bh=cRT3X+uLWIo/WDT/dysE7g0AVNehkJ5rdYqVsI+vjX4=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version; b=sJGQalf5ygsLz6W7crwPcqJPg9D2iGQDLglH0ceLy/J91sAwjpOeLVrpyKsKv+GF3c/o5LJ9MTIYYGxWiDZdwZrtpK4DnTjYj/bwd04ljxHUXXks+AJ62V2K+q6ynlRDjwUtctZuSI/7xszZJI9mjsIOksy7n6En4OXN4lYeN9g=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn; spf=pass smtp.mailfrom=shingroup.cn; arc=none smtp.client-ip=54.207.22.56
Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn
Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shingroup.cn
X-QQ-mid: bizesmtp87t1711863353tvqruomb
X-QQ-Originating-IP: dHu89vOsfyXlaQKZF86cBB1XYRxM3aKc0t7f88USl8g=
Received: from localhost ( [112.0.147.175])
by bizesmtp.qq.com (ESMTP) with
id ; Sun, 31 Mar 2024 13:35:52 +0800 (CST)
X-QQ-SSF: 01400000000000704000000A0000000
X-QQ-FEAT: rZJGTgY0+YOuhoc1+jgTQzFXybo6WpkwHmAznXexq7mNnvmJOrZ22rJCyRlxA
yv+DUYrg83tauZiFD4e5OeolzNLxCkYZAI3ridWwMnx2JQecfKQBp6G915QB7WwOeONSCAQ
yiiu0Z+ri/Nw7546cTU5FunYzRvLQVeaNQXN84uh1FHxLo6fpmfcrxm7/+sMZdYHa3cAaRl
lTYuZWrjb5rQtysFSnufhD17smjbr9Zod6O8MaB8Un+YnXkUvQCTJjP7wxCo8r0n+rP7Omt
ETATyyanGMCSnkBeXJDPkdGNQF1RQgjq6q60WhxSBKe90UnQzoh9rQ6lzMDcGqqJm5fJaTq
T82qGnoMMUZejzj1HUiSxMd5lxp71G2bssZRY5kxGdGRmMmri9sTkshPuxG6SH3lpBNpj3e
X-QQ-GoodBg: 2
X-BIZMAIL-ID: 4506703939604469898
From: Dawei Li <dawei.li@shingroup.cn>
To: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <ioana.ciornei@nxp.com>, <wintera@linux.ibm.com>,
<twinkler@linux.ibm.com>
CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-s390@vger.kernel.org>, Dawei Li <dawei.li@shingroup.cn>
Subject: [PATCH net-next v2 1/2] net/iucv: Avoid explicit cpumask var allocation on stack
Date: Sun, 31 Mar 2024 13:34:40 +0800
Message-ID: <20240331053441.1276826-2-dawei.li@shingroup.cn>
X-Mailer: git-send-email 2.27.0
In-Reply-To: <20240331053441.1276826-1-dawei.li@shingroup.cn>
References: <20240331053441.1276826-1-dawei.li@shingroup.cn>
Precedence: bulk
X-Mailing-List: linux-kernel@vger.kernel.org
List-Id: <linux-kernel.vger.kernel.org>
List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org>
List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-QQ-SENDSIZE: 520
Feedback-ID: bizesmtp:shingroup.cn:qybglogicsvrgz:qybglogicsvrgz5a-1
Return-Path: linux-kernel+bounces-125959-steffen.klassert=secunet.com@vger.kernel.org
X-MS-Exchange-Organization-OriginalArrivalTime: 31 Mar 2024 05:37:14.7545
(UTC)
X-MS-Exchange-Organization-Network-Message-Id: 19b28e6c-dddc-4bb1-ec3c-08dc51449f08
X-MS-Exchange-Organization-OriginalClientIPAddress: 62.96.220.37
X-MS-Exchange-Organization-OriginalServerIPAddress: 10.53.40.201
X-MS-Exchange-Organization-Cross-Premises-Headers-Processed: cas-essen-01.secunet.de
X-MS-Exchange-Organization-OrderedPrecisionLatencyInProgress: LSRV=mbx-essen-02.secunet.de:TOTAL-HUB=17528.705|SMR=0.326(SMRDE=0.005|SMRC=0.320(SMRCL=0.103|X-SMRCR=0.319))|CAT=0.054(CATOS=0.001
(CATSM=0.001)|CATRESL=0.013(CATRESLP2R=0.005)|CATORES=0.036(CATRS=0.036(CATRS-Transport
Rule Agent=0.001 |CATRS-Index Routing
Agent=0.034))|CATORT=0.001)|UNK=0.001|QDM=6656.202|SMSC=0.018
|SMS=1.820(SMSMBXD-INC=1.814)|QDM=10865.222|CAT=0.023(CATRESL=0.021(CATRESLP2R=0.001
))|QDM=5.124|CAT=0.052(CATRESL=0.050(CATRESLP2R=0.031));2024-03-31T10:29:23.461Z
Content-Type: text/plain
X-MS-Exchange-Forest-ArrivalHubServer: mbx-essen-02.secunet.de
X-MS-Exchange-Organization-AuthSource: cas-essen-01.secunet.de
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-FromEntityHeader: Internet
X-MS-Exchange-Organization-OriginalSize: 8075
X-MS-Exchange-Organization-HygienePolicy: Standard
X-MS-Exchange-Organization-MessageLatency: SRV=cas-essen-01.secunet.de:TOTAL-FE=0.008|SMR=0.008(SMRPI=0.006(SMRPI-FrontendProxyAgent=0.006))
X-MS-Exchange-Organization-Recipient-Limit-Verified: True
X-MS-Exchange-Organization-TotalRecipientCount: 1
X-MS-Exchange-Organization-Rules-Execution-History: 0b0cf904-14ac-4724-8bdf-482ee6223cf2%%%fd34672d-751c-45ae-a963-ed177fcabe23%%%d8080257-b0c3-47b4-b0db-23bc0c8ddb3c%%%95e591a2-5d7d-4afa-b1d0-7573d6c0a5d9%%%f7d0f6bc-4dcc-4876-8c5d-b3d6ddbb3d55%%%16355082-c50b-4214-9c7d-d39575f9f79b
X-MS-Exchange-Forest-RulesExecuted: mbx-essen-02
X-MS-Exchange-Organization-RulesExecuted: mbx-essen-02
X-MS-Exchange-Forest-IndexAgent-0: AQ0CZW4AATQFAAAPAAADH4sIAAAAAAAEAI1VW3ObVhA+SAgQNo5rJ2
3SPnT7kki2kG+J44mbTjyOnfH4kkxT55VBcJCZYFC5yPG0/Xv9Xd09
gIUknIZBcDi7++337S7o3+XjKIbD9xfHJ++sww+X5wcfT633x8cf/z
g4PH19C595HPKgB/zLKPAdPwU7CCLHTv0ohMgDZ5Rd28lnQx/bsW8P
Ag64n6S28xn8BMIohZg70fU1D13uQuKHDgcEcewQf1nCYRSlPEx9O8
ijDD0a89gLopu+oRv6SZik3HZ7BQ1wIpdDchVlgYtEbuzbBAhkraBh
IQs4+HDSSbqQRiVVbuiFHcjuY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0cmluZz4NCiAgICAgIDwvUGVyc29uPg0K
ICAgICAgPEVtYWlscz4NCiAgICAgICAgPEVtYWlsIFN0YXJ0SW5kZX
g9IjM5MCIgUG9zaXRpb249IlNpZ25hdHVyZSI+DQogICAgICAgICAg
PEVtYWlsU3RyaW5nPmRhd2VpLmxpQHNoaW5ncm91cC5jbjwvRW1haW
xTdHJpbmc+DQogICAgICAgIDwvRW1haWw+DQogICAgICA8L0VtYWls
cz4NCiAgICAgIDxDb250YWN0U3RyaW5nPkRhd2VpIExpICZsdDtkYX
dlaS5saUBzaGluZ3JvdXAuY248L0NvbnRhY3RTdHJpbmc+DQogICAg
PC9Db250YWN0Pg0KICA8L0NvbnRhY3RzPg0KPC9Db250YWN0U2V0Pg
EOzwFSZXRyaWV2ZXJPcGVyYXRvciwxMCwyO1JldHJpZXZlck9wZXJh
dG9yLDExLDE7UG9zdERvY1BhcnNlck9wZXJhdG9yLDEwLDA7UG9zdE
RvY1BhcnNlck9wZXJhdG9yLDExLDA7UG9zdFdvcmRCcmVha2VyRGlh
Z25vc3RpY09wZXJhdG9yLDEwLDE7UG9zdFdvcmRCcmVha2VyRGlhZ2
5vc3RpY09wZXJhdG9yLDExLDA7VHJhbnNwb3J0V3JpdGVyUHJvZHVj ZXIsMjAsMTc=
X-MS-Exchange-Forest-IndexAgent: 1 2357
X-MS-Exchange-Forest-EmailMessageHash: 31D07584
X-MS-Exchange-Forest-Language: en
X-MS-Exchange-Organization-Processed-By-Journaling: Journal Agent
X-MS-Exchange-Organization-Transport-Properties: DeliveryPriority=Low
X-MS-Exchange-Organization-Prioritization: 2:RC:REDACTED-af51df60fd698f80b064826f9ee192ca@secunet.com:42/10|SR
X-MS-Exchange-Organization-IncludeInSla: False:RecipientCountThresholdExceeded

For CONFIG_CPUMASK_OFFSTACK=y kernel, explicit allocation of cpumask
variable on stack is not recommended since it can cause potential stack
overflow.

Instead, kernel code should always use *cpumask_var API(s) to allocate
cpumask var in config-neutral way, leaving allocation strategy to
CONFIG_CPUMASK_OFFSTACK.

Use *cpumask_var API(s) to address it.

Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
---
net/iucv/iucv.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index a4ab615ca3e3..5e37a8ceebcb 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -520,7 +520,7 @@ static void iucv_setmask_mp(void)
*/
static void iucv_setmask_up(void)
{
- cpumask_t cpumask;
+ static cpumask_t cpumask;
int cpu;

/* Disable all cpu but the first in cpu_irq_cpumask. */
@@ -628,23 +628,33 @@ static int iucv_cpu_online(unsigned int cpu)

static int iucv_cpu_down_prep(unsigned int cpu)
{
- cpumask_t cpumask;
+ cpumask_var_t cpumask;
+ int ret = 0;

if (!iucv_path_table)
return 0;

- cpumask_copy(&cpumask, &iucv_buffer_cpumask);
- cpumask_clear_cpu(cpu, &cpumask);
- if (cpumask_empty(&cpumask))
+ if (!alloc_cpumask_var(&cpumask, GFP_KERNEL))
+ return -ENOMEM;
+
+ cpumask_copy(cpumask, &iucv_buffer_cpumask);
+ cpumask_clear_cpu(cpu, cpumask);
+ if (cpumask_empty(cpumask)) {
/* Can't offline last IUCV enabled cpu. */
- return -EINVAL;
+ ret = -EINVAL;
+ goto __free_cpumask;
+ }

iucv_retrieve_cpu(NULL);
if (!cpumask_empty(&iucv_irq_cpumask))
- return 0;
+ goto __free_cpumask;
+
smp_call_function_single(cpumask_first(&iucv_buffer_cpumask),
iucv_allow_cpu, NULL, 1);
- return 0;
+
+__free_cpumask:
+ free_cpumask_var(cpumask);
+ return ret;
}

/**
--
2.27.0