Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1288736lqh; Mon, 6 May 2024 03:10:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxPMaWJVPdkOiF3aui88SolZ6byJ0HIxJGE4gH9c/o2XSIJwrxwGgm3X20iGKr5MRW9oMZpLtCP74/UJaY/fTY5AxICmFhCC3Cmpxu1A== X-Google-Smtp-Source: AGHT+IHrc75pQTTMBNiuLmAuNXHS2/oS4PE/1FVu2tPwzLuF2h3Wy7y/zeHRYbQZ4pqrnz5yJYjS X-Received: by 2002:a17:906:6a1a:b0:a59:ce90:27ea with SMTP id qw26-20020a1709066a1a00b00a59ce9027eamr1600750ejc.24.1714990228316; Mon, 06 May 2024 03:10:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714990228; cv=pass; d=google.com; s=arc-20160816; b=A5GBIW9Zp0bssgcQcxUfmZlOHAqqGvnU+p4wLdg91j7VLAAWO2MP7q4CmflmjCg30D qnh1IAjEZEx/Xp752Rwr8UJ8Ick0BBpEt5TNk3ObNoTIMJHCFNLw8FxN55idijBM4rNt dE0fvJ4pshUxTJzlaGhwSNfAx4cEg6AWbngB7rznu3M15CKbITBUp4M9o5qu4TcZNjTQ SIdXH7xWPeI82W/yFhrxPe6fX4CC1LvDsqvIwWgbwadO0o9ity8Zhehqo9Rd43+nowoI 9BOlx+YTQRMlAj6atoAnAmSgHvXBOxrwLwrfpgP378L8qnEEicCaqtGsgttNXnk05oOX imyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jNkOfFfDXaiV3uIcZKQL9wh7a+8m+AO8jOVSKisRhts=; fh=SnK9lITZUF205uhS7Dp6eEv0GRC9hnJZEzs5k/951N4=; b=O8imZdryQQ7rRuXgaGIHsGjNIYEJQNE5Qi7g607edDcjH+t/EWL7r63zlCnlswrl7A cCJEn7VPse2ZerxD/S+gnxEeyAx1gkrXLTsVh58BgV3XIedatUD5j6BJ3x6RsjQr6X4g GSFuObEVctxhRNNw1rjqbsgCnrxFLHLcmE8J3vGH4URlNTLu7EgzKQ18ChJc7ONYaYlc cEZ17k5x5FJqh3zLjSKqTxQl8GNr8vAjrhSNWF+6MS1joBd0G/aplC3I1U2s5Zj9RIby 03x1fRCTw7SQ5SejlCd3ahX6XUiqbYb7En7ASzJKisXATQ9D1dXbULIF6kysXgjoMc/j a96g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="POa9s/Iy"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169645-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169645-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id w5-20020a170906480500b00a59bc417a20si2013015ejq.453.2024.05.06.03.10.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 03:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169645-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="POa9s/Iy"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169645-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169645-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 11AED1F2367B for ; Mon, 6 May 2024 10:10:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EA2F14264C; Mon, 6 May 2024 10:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="POa9s/Iy" 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 454EF4205F for ; Mon, 6 May 2024 10:10:20 +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=1714990221; cv=none; b=kYE61dgo/0FV/eLqkFrR9R+/g5hupgu3CO/x03cJyjnWDiY06IqKyDzsCL2AVOADa8GJGtsWBlm30nufHm2wb8A3RFno6ERcHBQvSHNBIzmtk6MoG4wihy91mGUL3UzOByVD9K9kN7X447Oc7v/6lOBwS8ZKJ4l8QWuXXIqwQKk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990221; c=relaxed/simple; bh=UabQAUK3En/3LuQtSYQlzotWfnD5PxaHVAmlM/KgexY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XZh2+7Ednr/lf+1yjPHiwtZ/Zoml5j7zraBrzatWCfnybVUT2GxHe8M7y9jW27ggp0OBVoyRuypeQ1P8LfCCsF22YQmgV7u6ljRQZNguEOffGLQ18ngvN9s6IHoxIosaweb7+lqB68zvjPHZmAPyuXnNMckP6HTIQ7Z93/h1H8A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=POa9s/Iy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A86AC116B1; Mon, 6 May 2024 10:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714990220; bh=UabQAUK3En/3LuQtSYQlzotWfnD5PxaHVAmlM/KgexY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=POa9s/IyH2KONdMog2F87clkt9RkLiiCEbUFSlSahXaf9QNTa+Hkb3NbnY6BpWXR2 4TtYfDmCpBm6qw8u1tWr6ae/r+ygOO9g43wmf/e3txPtg3X5xtt1c2P5sL6uD6/Ivg HoLt91aG6hn64wU3Vm5c/eKtrwdhylPC+jQoYeiUPu9lUeNCN4965w70yg4jDCbrm+ yD9BAKypIRpRKvIKzyMVJgF1Bd5xNitokhPRsgHEgzcErKx/yLDgx8BNqmCro2Z0m2 jooiRUOkbq//YgQiYv0lZ/r23KlLgjNM5CMJzH07Dy8UNQFZ3ZgTv0rKM7zdZKmwpl WWxK0YwHUYOpQ== Date: Mon, 6 May 2024 12:10:18 +0200 From: Frederic Weisbecker To: Levi Yun Cc: anna-maria@linutronix.de, tglx@linutronix.de, Markus.Elfring@web.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] time/timgr: Fix wrong reference when level 0 group allocation failed Message-ID: References: <20240505085709.82688-1-ppbuk5246@gmail.com> <20240506041059.86877-1-ppbuk5246@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240506041059.86877-1-ppbuk5246@gmail.com> Le Mon, May 06, 2024 at 05:10:59AM +0100, Levi Yun a ?crit : > When tmigr_setup_groups() failed level 0 group allocation, > wrong reference happens on local stack array while intializing timer hierarchy. > > To prevent this, Check loop condition first before initializing timer hierarchy. > > Fixes: 7ee988770326 ("timers: Implement the hierarchical pull model") > Signed-off-by: Levi Yun > --- > v3: > - Fix typo. > > v2: > - Modify commit message. > > kernel/time/timer_migration.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c > index ccba875d2234..84413114db5c 100644 > --- a/kernel/time/timer_migration.c > +++ b/kernel/time/timer_migration.c > @@ -1596,7 +1596,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node) > > } while (i < tmigr_hierarchy_levels); > > - do { > + while (i > 0) { > group = stack[--i]; > > if (err < 0) { > @@ -1645,7 +1645,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node) > tmigr_connect_child_parent(child, group); > } > } > - } while (i > 0); > + } Looks good to me. But let's wait for Anna-Maria's second look. The group setup is not my favourite area... Thanks. > > kfree(stack); > > -- > 2.41.0