Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp852861pxp; Wed, 16 Mar 2022 19:06:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoGxmuZVAcKZb6Tmi1Wn3diLEv7FZD2+px5GgYovm96tltn8xCs/l+aVtDsRBI9VssIQXm X-Received: by 2002:a17:907:3f10:b0:6da:818d:4525 with SMTP id hq16-20020a1709073f1000b006da818d4525mr2244466ejc.47.1647482763939; Wed, 16 Mar 2022 19:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647482763; cv=none; d=google.com; s=arc-20160816; b=tlFktr0GefMJYRbfA6oi9jHWU1Mxw8eH7325D8czoN1f9VFG4ubujdnJSTbROT5crb odtmke6CEkRtEHctgXJ8VujaUxAc5fgqr8zob0BqiztV1SyYhRoLDa0wc/Q3MbZd1djY cJQmVf/lvsYUTCKHXZvsRPKAp9Z6ATqk/pxC7CBTb5ge54N/rX4dKuM5gka87juucmLc eBIUHx95l8+TIyAa2PisljACA9NRx64Iqsml/Vaps/gSPPswzLBkB8A3HAvXCNLPtufl uSv4DvTTs/qRLBq6YtMWIuq3STTutRqvbXXS7/4Zk3sujeWAQyQrq6wOC5m8KcbTPqBw HiEw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jZQBsUn3wIG3eVoA03h8vq3ENW/tPMnuHuTwlaAjs3A=; b=LYG+jEjvk+YMUWOE8Xu0amUd0FQ9o2KumERgi5xyqsRBBGeivtsEglb8Kczzq6PmDb wN/YAIUSoceZCvqtGMrjyBU8Dumy3SJYznPK9+tD3jKgXhEYwTQYWXy6ZZU+Vmi5sGyi KUC3PSkrCas9ZeIc504CVtMUQqyRjG9nmXRij8cJLlOb7syJ8w+VAMsBtc6pgYo5+7Dn V+NCtRAnEWFw7xFiM5MtPjOQmdJWvHdF56McAaF1/+HO3grDXoWImXX4x1my4G6nALIR TNKHKuhs9+rrBQnQmWAE7QTSUN6CZUEdDKwyTt0/Z5eVX2dFSxmxsAZYVkzPS5GreRhY AaYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=VlfYOU1l; 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=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v8-20020a170906180800b006ce06d94796si1989248eje.389.2022.03.16.19.05.39; Wed, 16 Mar 2022 19:06:03 -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=@canonical.com header.s=20210705 header.b=VlfYOU1l; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357575AbiCPQt7 (ORCPT + 99 others); Wed, 16 Mar 2022 12:49:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357561AbiCPQtw (ORCPT ); Wed, 16 Mar 2022 12:49:52 -0400 Received: from smtp-relay-internal-1.canonical.com (smtp-relay-internal-1.canonical.com [185.125.188.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FC0936E37 for ; Wed, 16 Mar 2022 09:48:37 -0700 (PDT) Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id BCBBE3F338 for ; Wed, 16 Mar 2022 16:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1647449314; bh=jZQBsUn3wIG3eVoA03h8vq3ENW/tPMnuHuTwlaAjs3A=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VlfYOU1l0p8qrXo98PUp1fALGRGv0IDc8rD/bpyizmFZVKhSuFf5JjeA3HA5qjepK s63lQyy+frQ71d57sQhmOFM8qWRTwBcwLOiPrgyPRXcM5tMlxmWQpMVpWBBaex6U09 m8tkdJ5chy5P5aB1Ak0NrpS98SBQueFSoHKuc9X7ysAxP9YmfLc7XhXFpJczoFX3tZ cfRTziIOpvYdY1OezPmc/mcmkkp4w6forD1qWLdWCuSsh70c2qvuVAq1o3u+PqsNa1 hplPhbUp2zfyHEl0bsYFhROQ99bIBrImx7pkGpaDChKewQcas5k5/k29eH6KDMnvw2 n5IdH0ptn311Q== Received: by mail-io1-f70.google.com with SMTP id z10-20020a056602080a00b00645b9fdc630so1636632iow.5 for ; Wed, 16 Mar 2022 09:48:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jZQBsUn3wIG3eVoA03h8vq3ENW/tPMnuHuTwlaAjs3A=; b=7wtuztVIshXiiEKiZ1mj7TgW7Ru4ovjeNA4CeeUOkVvb2ihQQMkf3ghoVkn774evjN F3yBaFG0/eEc35rlEoMELp6zv8VIHXEwuBjwOWeKg5spL1jdzRStA5cMSNw3KoreRvB6 +zFGKeWKI/wxNnr6qajyrbjEc+beqmhd2bTVKoxvPVvM1X8xACUZnQ4LgvWzXP0PQGtx Md0MYAtkk66OWcdziOl/7kbGScI2fKTFLCA+amGm2wcjvzOA7sddXnMdHtAohN/epPa4 Ij1DT61l/vkcnaQ2SJO/7ySITEs1XcTKLwMLO0WvxpoUkRaww+GIE2NAnHtncueLMNcQ zFrQ== X-Gm-Message-State: AOAM531yO4x3/CKGfZ2XKe9qLxL72ODpFQQu0AdBGDGFpbuc6hAM2lv5 +vwu6x4Mzuf5GmGfihWYDQXQUaa+1q93GUbbqhGYopeQEKkY/KS24Og3UaoIR1h8Bai/32RsYp0 xaUIyfYbIeRcgH11zW3B3wYfmn/Wbvklkz+7aA3z7ZA== X-Received: by 2002:a05:6638:dcf:b0:319:e022:ad6c with SMTP id m15-20020a0566380dcf00b00319e022ad6cmr183595jaj.143.1647449313457; Wed, 16 Mar 2022 09:48:33 -0700 (PDT) X-Received: by 2002:a05:6638:dcf:b0:319:e022:ad6c with SMTP id m15-20020a0566380dcf00b00319e022ad6cmr183567jaj.143.1647449312727; Wed, 16 Mar 2022 09:48:32 -0700 (PDT) Received: from localhost (c-71-196-238-11.hsd1.co.comcast.net. [71.196.238.11]) by smtp.gmail.com with ESMTPSA id i11-20020a056e020d8b00b002c79690d56esm1449277ilj.10.2022.03.16.09.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 09:48:31 -0700 (PDT) From: dann frazier To: stable@vger.kernel.org Cc: Valentin Schneider , Dietmar Eggemann , Peter Zijlstra , Ingo Molnar , Vincent Guittot , John Paul Adrian Glaubitz , Sergei Trofimovich , Anatoly Pugachev , Andrew Morton , Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH v2 4.19 2/3] sched/topology: Fix sched_domain_topology_level alloc in sched_init_numa() Date: Wed, 16 Mar 2022 10:48:07 -0600 Message-Id: <20220316164808.569272-3-dann.frazier@canonical.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220316164808.569272-1-dann.frazier@canonical.com> References: <20220316164808.569272-1-dann.frazier@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Dietmar Eggemann commit 71e5f6644fb2f3304fcb310145ded234a37e7cc1 upstream. Commit "sched/topology: Make sched_init_numa() use a set for the deduplicating sort" allocates 'i + nr_levels (level)' instead of 'i + nr_levels + 1' sched_domain_topology_level. This led to an Oops (on Arm64 juno with CONFIG_SCHED_DEBUG): sched_init_domains build_sched_domains() __free_domain_allocs() __sdt_free() { ... for_each_sd_topology(tl) ... sd = *per_cpu_ptr(sdd->sd, j); <-- ... } Signed-off-by: Dietmar Eggemann Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Tested-by: Vincent Guittot Tested-by: Barry Song Link: https://lkml.kernel.org/r/6000e39e-7d28-c360-9cd6-8798fd22a9bf@arm.com Signed-off-by: dann frazier --- kernel/sched/topology.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 0826f3f4920a..02e85cd233d4 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1428,7 +1428,7 @@ void sched_init_numa(void) /* Compute default topology size */ for (i = 0; sched_domain_topology[i].mask; i++); - tl = kzalloc((i + nr_levels) * + tl = kzalloc((i + nr_levels + 1) * sizeof(struct sched_domain_topology_level), GFP_KERNEL); if (!tl) return; -- 2.35.1