From nobody Sun Apr 5 16:29:47 2026 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 E1BD442050 for ; Tue, 24 Mar 2026 18:03:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774375405; cv=none; b=OS/By+ELvy/TrFUe6ylP2plN58s1QucQuC4hEQ799IW2enQccZYgkPJBWzVEAJITt991uVxukSpx7SiDl/V7iYYgwIEXKtpESZlHylh9z2mryn/AtlbXr4MiQhu4MOR8cDibCJ+TwbiiAllkn+9Nri5+g15RI+papd2orV9FwPc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774375405; c=relaxed/simple; bh=FYrrfu8NUb3hdqDI87e8nxqxEBFUBEO9zOcqIuWCG80=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ro1ttsPu9u/jwP2DCGyI7kpH1xSMs4jBzwMrz7cKY1Lwf+9/cgGodR09hLZLgnW91JhjhWe5pWu0Rjej+DI2ln91yNilegCFx2Crhe9CeG2xAGMalBuH3VJiIvj+D1/PS38kaRMFrbYCxnw+DiwgTm4q0ggUbNHrig4bR7mmWno= 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=FAePJU1w; arc=none smtp.client-ip=209.85.216.51 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="FAePJU1w" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-354bc7c2c46so2778723a91.0 for ; Tue, 24 Mar 2026 11:03:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774375403; x=1774980203; 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=Rhbz2of6+Xe2Zo/07pNkzuZohlohkmzeKfJt3hElN40=; b=FAePJU1wwEYJEyMWqgUWD/9kNX1HX8v3dxJDanAZRoqA5gGBdTOwW6k6aQ6ag6Y9We 7sG/zZe76WckAfIbQ9TY/NLXyrwaWGUxlRInEAAkXj6h7QIOlzNfFWUsWoQs8gs6G3eJ rMp7uUhUM0vLLSOTHF5IL+U75OkVB8ASkH8ToIz3Vk/RLCe+5PltcWdWiDp/8WsXcH8+ 14ldk0gZ674BXxum25SHRS3I3A0Hf/1SCayDM9zUT84wGICq4BBWG32AJDnoPKRWUJCi P0N4noiPcP8JgSixa1Jd/7Xyk7rKSqx+FvtTq3Q+XH0zWXPiddehKZ32aJEoqzWWmmYc loqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774375403; x=1774980203; 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=Rhbz2of6+Xe2Zo/07pNkzuZohlohkmzeKfJt3hElN40=; b=iaxIT05j2MATiDc/spsWaqOhotnFu7DpAQmtRMNPwFAMrns3V4gjGbh80ij/MEFr4X Myx5h9b3Drh7Tbfs03NVYCdeZXH66ZovOiUdmzfUUw53EWAgiFfAOiH86QulgayNZ7+W iVNxX3p1t1izFOjTqiACo1X5RfkRAzX0LGDoRsL8Sf0AOeltTtKzTRbm9fjSQurC1aHi WrbO8eY1psz1zeegPnH/t+q3wF42jZnTfjwTKvpampLfQDzKoCabxeZ5l2GKW4ZVbFwM lMjwjXu+9gEiBCncDsG5byEeyKyDo+/7JD9G2EGmwzvVdSKV5IRy/gP7EhTLnFuUePwT CzNg== X-Forwarded-Encrypted: i=1; AJvYcCUaMiPnQ7tMTiqBWEwVP5mEFiSt96jdKiOIGnt5ovtnH3k0kZdbC9SLX2VhN6jXjvqy3zkiPBEHby28C6Y=@vger.kernel.org X-Gm-Message-State: AOJu0YzpoU/gKJ3p1ywvqgDyCwtUQpu7nOiFToWiq9+wZCWR0018jUiU s+uvjr2AygsVl6aSQ6CfnrzR6egznA4g7QWKu09Bv4m6PGrGn4d4w6vb X-Gm-Gg: ATEYQzyp9d0k+nexwPXmFnWq9+SXD+TEEp5I4mye5XQsnz2MSU+6fgppD9lq7u52nez e1Nkpki1cM91zBbKNGmDOksRYSKUMOJwAQ/yX3e/SSma/yAPCLkjDZfbVhBmfNVCEviZV8SG3Hq F3hX0chl4HJsZ/fYnAIBfsrFaN+NxdcwsVkqvwZTLX0KJARUwGmBYyhqGzYyveTTo643agEXXi6 rBF1HevPwy1PcFCn5abJ9mO7bY6ryMM6DK6uHQVogw53lxCFqR9wV5DoUdM5GK4ve3phzf9SFmT 1AT4F5i6qCQUO6XzzYgowkpsRqyLFyCiMh3xJCfOWZBIh20YlduLS52fAQUE+Gf3rdQrGRzD/9T Bh5MVQKwcW7DHMIbUacirLwVfz68q5RumWY25lNeO/ccGNJlfuRkTr6lJKdT4gLvLYsczfjZsy4 pf/SnrI+7meavUaUEVnr2YlW9/ZGG2ylX6 X-Received: by 2002:a17:90a:e7d1:b0:359:83d3:27d3 with SMTP id 98e67ed59e1d1-35c0dc84216mr292653a91.2.1774375401923; Tue, 24 Mar 2026 11:03:21 -0700 (PDT) Received: from ArchDesktopLeo ([2400:a840:5c41:0:e012:ea6c:986:40a8]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35c03124a94sm3179079a91.2.2026.03.24.11.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 11:03:21 -0700 (PDT) From: Leo Timmins To: Pasha Tatashin , Mike Rapoport Cc: Pratyush Yadav , Andrew Morton , linux-kernel@vger.kernel.org, Leo Timmins Subject: [PATCH 3/3] liveupdate: initialize incoming FLB state before finish Date: Wed, 25 Mar 2026 02:02:58 +0800 Message-ID: <20260324180258.1282560-4-leotimmins1974@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260324180258.1282560-1-leotimmins1974@gmail.com> References: <20260324180258.1282560-1-leotimmins1974@gmail.com> 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" luo_flb_file_finish_one() decremented incoming.count before making sure that the incoming FLB state had been materialized. If no earlier incoming retrieval had populated that state, the first decrement ran from zero and skipped the last-user finish path. Initialize the incoming FLB state before the first decrement so finish uses the serialized refcount instead of an uninitialized value. Fixes: cab056f2aae7 ("liveupdate: luo_flb: introduce File-Lifecycle-Bound g= lobal state") Signed-off-by: Leo Timmins --- kernel/liveupdate/luo_flb.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/liveupdate/luo_flb.c b/kernel/liveupdate/luo_flb.c index f52e8114837e..49fed585e965 100644 --- a/kernel/liveupdate/luo_flb.c +++ b/kernel/liveupdate/luo_flb.c @@ -192,10 +192,24 @@ static int luo_flb_retrieve_one(struct liveupdate_flb= *flb) static void luo_flb_file_finish_one(struct liveupdate_flb *flb) { struct luo_flb_private *private =3D luo_flb_get_private(flb); + bool needs_retrieve =3D false; u64 count; =20 - scoped_guard(mutex, &private->incoming.lock) + scoped_guard(mutex, &private->incoming.lock) { + if (!private->incoming.count && !private->incoming.finished) + needs_retrieve =3D true; + } + + if (needs_retrieve) { + int err =3D luo_flb_retrieve_one(flb); + + if (WARN_ON(err)) + return; + } + + scoped_guard(mutex, &private->incoming.lock) { count =3D --private->incoming.count; + } =20 if (!count) { struct liveupdate_flb_op_args args =3D {0}; --=20 2.53.0