Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2830323pxp; Tue, 8 Mar 2022 02:43:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfEQYMXHX/WFvbEEKZ04BX/PILbFlUpOxTRYPtf1aTJI+0Ypn+1G5IqdUcfSWAXp6zluie X-Received: by 2002:a05:6402:d06:b0:412:eafd:8b9a with SMTP id eb6-20020a0564020d0600b00412eafd8b9amr15568518edb.278.1646736211723; Tue, 08 Mar 2022 02:43:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646736211; cv=none; d=google.com; s=arc-20160816; b=d2rNTSbEIoz5vpT4lJPxdRuosUfbpqZ60fCoPXIZDfQM7R87THaZJYh2VZtlDkRp9f xPw4kcBijh6+H2bpEXXIrfUs8PGjGglDwwrcqFiTAzDX7gp4NenUoWZtGK+8Aa4ZsCwc YdMMx6LDR9Y4vcaR34uPWOntUH+v5GdcpNYKXbbytS2Ofghfpz2apLKsY29ImSwK0Yhi BDXTjvbuf2rbBx8rD+krWcuHyQTIP5KFqsi4XP1SpqAEJIg2+aJPReTdE41Mq4+zso12 ChsAP8qQRtHWnOt3tqI3wHRK7aa3xIuXB5SGeNCOOI8fbQoB2Nyms4waXn4xPcz5tykE 2f7Q== 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=wYDSBk7iUMWwKBfS03BdFKJC7SiK0s9WxGrCHtrTAag=; b=eOCo8NriHX9Op4A5W/0HPxnCdXVP9ZLI8+rwjcByV5tkeZ3sE0bHs+5dAezrhhaRaS Kvg0vBBqEEoiDAil6DGfDS4diQsLhxZUb9A1527u/Il7d7Uh3vG0nI9PPz5XJ1qwB4OF vc1srWuEI25V1W2tnkDo+zzT0XyKg6qDLeU/vOFM0LIiiHtlDdR5ZuVWRvc4SaR3LTnZ jtWJ9RW5K3a0gDzGqwulm17Zy79gwsrCwetRO5nTMWSo8LECCp1agXalRaIFkhD/Q046 dI24Kes7P9aQ/ezD9oknsJzmU/WcitznKZB+BEY4/dav1LnDeC9C6sQzFXlvXmJOH68c xhSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=cbZzHdVI; 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 b10-20020a056402350a00b004165be265cfsi2857884edd.318.2022.03.08.02.43.04; Tue, 08 Mar 2022 02:43:31 -0800 (PST) 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=cbZzHdVI; 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 S245231AbiCGUBM (ORCPT + 99 others); Mon, 7 Mar 2022 15:01:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245212AbiCGUBG (ORCPT ); Mon, 7 Mar 2022 15:01:06 -0500 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 0F7446E367 for ; Mon, 7 Mar 2022 12:00:12 -0800 (PST) Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) (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 E3C1B3F7E2 for ; Mon, 7 Mar 2022 20:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1646683210; bh=wYDSBk7iUMWwKBfS03BdFKJC7SiK0s9WxGrCHtrTAag=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cbZzHdVIq2LW2d3snlpxiCgpN4bW5uC9o0r7LudazHkxaKEUxoXC5vnyfQsUUnRXo bV8toV53GIUEtWlqaZ8bZ6Ip4o1E3fjkr03nWngeHZ/w6bYdO/Qpb6nUZaOG2mlNgu xT42K3L69jNVlHVJb7et+S5CAgV/okKr7ZwB2f09bAclz8TfBIoA0RQCZvCohlg/lM FHwEfSlmBtiSH8XReRL9mRHE04Ss8Z8phBVvoroKKXOn69EPFzE9b35LONl3pRgsoY lH8InKPLE2AjzeMuEGrjxkAssSLmx37ybEvGiv3DgFs6e9TorPji7GoLedzW8K+0f2 86HnPnaTyRhfA== Received: by mail-il1-f199.google.com with SMTP id y19-20020a056e02119300b002c2d3ef05bfso11013605ili.18 for ; Mon, 07 Mar 2022 12:00:10 -0800 (PST) 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=wYDSBk7iUMWwKBfS03BdFKJC7SiK0s9WxGrCHtrTAag=; b=OIDBQ39plrXZkdjSkfNal3kHFIaZnAOQ9mre7H2ZjqeSxsIOKjXExdNoGlugU0t9bN tpjSF7NxJpXcrF1bHwMmOPYWGtSyaFuU+lHqfumJV0zcqpNZmKwFowbsWQAuYjaDrVgW ubiwEZ2kMgJiKDI6R8p8e1Kx0lTggb1vkBNl8UNj9vgU5HFkKNdU8xKOZycyO/o9Jzt6 yGqsALoaGqknbdsVuxE38vCdyMjC4Pw+UOwueZZOUhCgWJicM/GuyByYuCSxecAihSmI uF/5rNMQNNc3GVHrh2nXzn3DfflBhcfMSGU1xZtbCktpIeMONfCKKv15lpx5eW8MguVn /nCw== X-Gm-Message-State: AOAM533kALRngIYlOVVhmoA5yr9ULs013de5XHp079Yrgj5kKEN1+CLg PlUzapvriM/3EPpd6DxW8/2Q+Lnxl1sveLDnNw7G5pkaNod4bicWjNB3QDGwZpigv1x+D02ZZ70 Y/LcwS1GI/PRS3XMCDTQWqW7K3uq+1IMTDdsPKJHoUA== X-Received: by 2002:a05:6e02:1445:b0:2c2:ea36:dcab with SMTP id p5-20020a056e02144500b002c2ea36dcabmr12631737ilo.200.1646683209809; Mon, 07 Mar 2022 12:00:09 -0800 (PST) X-Received: by 2002:a05:6e02:1445:b0:2c2:ea36:dcab with SMTP id p5-20020a056e02144500b002c2ea36dcabmr12631715ilo.200.1646683209602; Mon, 07 Mar 2022 12:00:09 -0800 (PST) Received: from localhost (c-71-196-238-11.hsd1.co.comcast.net. [71.196.238.11]) by smtp.gmail.com with ESMTPSA id w6-20020a056e021c8600b002c602537ab9sm11255624ill.54.2022.03.07.12.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Mar 2022 12:00:05 -0800 (PST) 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 4.19 2/3] sched/topology: Fix sched_domain_topology_level alloc in sched_init_numa() Date: Mon, 7 Mar 2022 12:59:40 -0700 Message-Id: <20220307195941.459076-3-dann.frazier@canonical.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307195941.459076-1-dann.frazier@canonical.com> References: <20220307195941.459076-1-dann.frazier@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.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=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 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.25.1