From nobody Sun Feb 8 18:09:28 2026 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00A1D330D4C for ; Thu, 5 Feb 2026 07:35:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770276958; cv=none; b=rLGV9ROfh2HG5fO3QiTEqtWT5YLEuzq/etpDMwKwtQkjrBJhwtJSBHiGVVF2vKEHv40O/dW46pFX7In5Tb5o0t2ztR7u+xdnW4yB9nKf2j+Ytwg1GdsGaV00LAk5lyTi1NfP0fEhFBQ2F9QXQH3mXTcOISW4eKj/3xuWWDc+mwQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770276958; c=relaxed/simple; bh=vLu2ksdhnqHRxXjVJ2tWyKlGCcHmLnTfLWeuQBZbV/g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d4aA6mocRc5Ui/JsewV52qx7apyD1lJjIrL6LDMEgqRYlTWFdi7Rc4ULsAQS8xdtd4AGdriQCZ9yx2roZeYHLc4Ve/10WE1iY5U1VpW73BwRZyz9QAg3Mho0uYCkOTCUzoxPj0yAiFCra9uS86wTOrWdXSaWNOFXWODAdNRmqK0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=CQOZO0n+; arc=none smtp.client-ip=209.85.210.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CQOZO0n+" Received: by mail-pf1-f182.google.com with SMTP id d2e1a72fcca58-823075fed75so461387b3a.1 for ; Wed, 04 Feb 2026 23:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770276957; x=1770881757; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BFso0UxtdtEddd4K3oGXMtKsVEhTg/lDpZkuARGpoug=; b=CQOZO0n+kfAxAnSdothtIu/j72TurRYN7bqHHRZJAScU5+K1V8NzxveFQq2QgqTcGN TYoXudhUl3Are7540Ucj+OO3vnvKrOuvteuKCi8cSII3Hx1/RHifOsiLTu6d5MtkWBpV Sch5oDGsKhwwldEZOBvUDbE+X0H0CgEYOItHsNW7Nha5XP69Gzj880tFeH6NTYDWyDh8 ZmDxBTtzSQCtxNgHFakPzyCXZhE300Q5iXk8NYw4wqvD94chXZUfWF1Czm+g/RkZwKhD bz1XDizGHC8gilqLdawwogKDinBow6aUfWyiMxdJn6CJlmoH2yodLQy97GhQVun0mG1P qcTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770276957; x=1770881757; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BFso0UxtdtEddd4K3oGXMtKsVEhTg/lDpZkuARGpoug=; b=TIdZSG6atkxmMoSCo/isAs2V7pfO039Xd7zDgxg6nvQks56sWde4xexyL82vXWACLO m+DeXRbLyWpI3ivhUh3GiFu24LS2Zv2IHovL4JdibWPVm7P5Tx3eEP8NWgDUYLBj8ODG K6q4oh0O9XcjN/BSn2PsKXAt4CZOkgfXueF22N31ZoT3+GXfjBHlkinU419c9rGNDClc D0JuD/elYWHyFny+/xq5FxNnDKf2KZU2x0sc5ZeZ0ZsTnenVsU9C+7Zn0FplhpoHc029 IrfYQ1hsWycytmpnK7Ld/hs9/m43VBcIsRA4VGrnzc4xEXPEb+waphsPYFn5d+g/pVSC Wa2A== X-Gm-Message-State: AOJu0Yx7+rLchPK80CZCXwvGR63gx+7dZb3WC1Z5ZZUJP9z1l5F2GWJF shebBcarA+LDRkYvM576qow5x7eV/jWE8fMbrjRsasBehfaxdjMi6/iB X-Gm-Gg: AZuq6aJcLtjPQuiqWugLJkKzIHMYMUUkrlogYs+T+quUm/7tvLV8rPuW9Igi//b8N/O 6KcFE3vPe2e3hRWvxovZ0MAx5+zrawuhyoR8P2YpiUbyYicIgWxjdvxZkBwKeEw2GAPDWJ5l7HV aYrZtau2E64ZzUSOjtSIpewhS2RMMKddLwbCpoHToySAq7d2WkqaUHw02vm/7OfF123Y/rN+S1S MI+CyWHAFcSeBikuK0COB9ikrGfccSGcrpZ909zE4X1ei03ynH8aQimLntVc8vOeSJvQemh9GjS hIBkzAnJZOKBMrOyBXj2BzRk/6xrcJs2F9py68EM079Mla5o+BUO3ABWlL4IGgkZ92BOAn3IKaw b6Ukk5ZRrG7Qz1Uf/Hsni3I9Liw1CwvpYyCis+aAPqfX1eV3RKG89ivzGcG3u7lrO6yiAvPWefb svo8PzYjg2GdleW3dP0eRJ20I/9jdrKCApTg0= X-Received: by 2002:a05:6a00:1a0f:b0:7e8:3fcb:bc41 with SMTP id d2e1a72fcca58-8242d90af89mr1567657b3a.22.1770276957288; Wed, 04 Feb 2026 23:35:57 -0800 (PST) Received: from DESKTOP-MOQC9AF.mioffice.cn ([43.224.245.239]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8241d438897sm4223847b3a.37.2026.02.04.23.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Feb 2026 23:35:56 -0800 (PST) From: Zhan Xusheng X-Google-Original-From: Zhan Xusheng To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Zhan Xusheng Subject: [PATCH v3] timers/migration: Ensure proper resource cleanup on error in tmigr_init Date: Thu, 5 Feb 2026 15:35:50 +0800 Message-ID: <20260205073551.101084-1-zhanxusheng@xiaomi.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <87ms1n1wga.ffs@tglx> References: <87ms1n1wga.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Free resources allocated by zalloc_cpumask_var and kcalloc on failure. Signed-off-by: Zhan Xusheng --- kernel/time/timer_migration.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c index 18dda1aa782d..ab8354ad85be 100644 --- a/kernel/time/timer_migration.c +++ b/kernel/time/timer_migration.c @@ -1994,7 +1994,7 @@ static int __init tmigr_init(void) =20 tmigr_level_list =3D kcalloc(tmigr_hierarchy_levels, sizeof(struct list_h= ead), GFP_KERNEL); if (!tmigr_level_list) - goto err; + goto err_free_cpumask; =20 for (i =3D 0; i < tmigr_hierarchy_levels; i++) INIT_LIST_HEAD(&tmigr_level_list[i]); @@ -2007,15 +2007,24 @@ static int __init tmigr_init(void) ret =3D cpuhp_setup_state(CPUHP_TMIGR_PREPARE, "tmigr:prepare", tmigr_cpu_prepare, NULL); if (ret) - goto err; + goto err_free_level_list; =20 ret =3D cpuhp_setup_state(CPUHP_AP_TMIGR_ONLINE, "tmigr:online", tmigr_set_cpu_available, tmigr_clear_cpu_available); if (ret) - goto err; + goto err_remove_prepare_state; =20 return 0; =20 +err_remove_prepare_state: + cpuhp_remove_state(CPUHP_TMIGR_PREPARE); + +err_free_level_list: + kfree(tmigr_level_list); + +err_free_cpumask: + free_cpumask_var(tmigr_available_cpumask); + err: pr_err("Timer migration setup failed\n"); return ret; --=20 2.43.0