From mboxrd@z Thu Jan 1 00:00:00 1970 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 B300E3DE448 for ; Thu, 16 Apr 2026 14:21:19 +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=1776349279; cv=none; b=WtF4CWdeU83rp6I0+R986CtUpn9t8joFWolfTYXakMYhG3y/4tWALx7pRo3OaM8yojBzgDCDpSbo3m9uKwEyJz8xICAVwO8sRBwMD3ZyExJYho6EQ/JCzonDB9Rk+TtogwMYxVIjFpoZ4e/pNVxn8iLNnXAsPRB2x6yh7CpQr80= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776349279; c=relaxed/simple; bh=goIGr1VWqtoxFlJd8A5Gj+T0KxtAuEIioygKOm6pnII=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=a99cv0xon48ErX60qiQpBPANFetX0ctlWI/47n3RW1PlKVaVyKo0dfd4XsT2ao//6+Suup2KdGtw4epOIosebOROZWbfPcKrKSgNoz0BJOA6uxQ/7ldAXXQfYMxva4qIUpcLnR9XMJP9YErLPXYqC8peudZSrjq+N/OMVQquRzc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Oe2t5+z7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Oe2t5+z7" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBB81C2BCAF; Thu, 16 Apr 2026 14:21:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776349279; bh=goIGr1VWqtoxFlJd8A5Gj+T0KxtAuEIioygKOm6pnII=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Oe2t5+z7jeGkFU/MpzQtFWXZsqynXqZ4J6NpuGlEk3K03M0+KQDfzqzIoCbO0yL3W UGw14fcnDzbxdobtmPd7iJWuRVScG7OOig+LNPPNHqHXNQSlylJyDuAux0dfyQg62f gSErogIWoQCR7b1M69KHitv1ZUi2d5yREua8EUvTLn5vLumpMWMFH5mCXmFfdfS02a uw2Hj1spvasrwAC1FGv485/xzb6SGBncFCBhplaCVJbbceTBHbBVkpFreiygCpqvJD 9sWw82CgB56xgsF9/+dsH8jS9uldKPF3PSSHnvTlcY97vTKsFDbxJgPHCalbTov77n Cf/UndihzvXig== Date: Thu, 16 Apr 2026 17:21:13 +0300 From: Mike Rapoport To: Pasha Tatashin Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, dmatlack@google.com, pratyush@kernel.org, skhawaja@google.com Subject: Re: [PATCH v4] liveupdate: fix return value on session allocation failure Message-ID: References: <20260415193738.515491-1-pasha.tatashin@soleen.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=us-ascii Content-Disposition: inline In-Reply-To: <20260415193738.515491-1-pasha.tatashin@soleen.com> On Wed, Apr 15, 2026 at 07:37:38PM +0000, Pasha Tatashin wrote: > When session allocation fails during deserialization, the global 'err' > variable was not updated before returning. This caused subsequent calls > to luo_session_deserialize() to incorrectly report success. > > Ensure 'err' is set to the error code from PTR_ERR(session). This > ensures that an error is correctly returned to userspace when it > attempts to open /dev/liveupdate in the new kernel if deserialization > failed. > > Signed-off-by: Pasha Tatashin > Reviewed-by: Pratyush Yadav (Google) Reviewed-by: Mike Rapoport (Microsoft) > --- > kernel/liveupdate/luo_session.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c > index a3327a28fc1f..7a42385dabe2 100644 > --- a/kernel/liveupdate/luo_session.c > +++ b/kernel/liveupdate/luo_session.c > @@ -514,11 +514,12 @@ int luo_session_deserialize(void) > { > struct luo_session_header *sh = &luo_session_global.incoming; > static bool is_deserialized; > - static int err; > + static int saved_err; > + int err; > > /* If has been deserialized, always return the same error code */ > if (is_deserialized) > - return err; > + return saved_err; > > is_deserialized = true; > if (!sh->active) > @@ -547,7 +548,8 @@ int luo_session_deserialize(void) > pr_warn("Failed to allocate session [%.*s] during deserialization %pe\n", > (int)sizeof(sh->ser[i].name), > sh->ser[i].name, session); > - return PTR_ERR(session); > + err = PTR_ERR(session); > + goto save_err; > } > > err = luo_session_insert(sh, session); > @@ -555,7 +557,7 @@ int luo_session_deserialize(void) > pr_warn("Failed to insert session [%s] %pe\n", > session->name, ERR_PTR(err)); > luo_session_free(session); > - return err; > + goto save_err; > } > > scoped_guard(mutex, &session->mutex) { > @@ -565,7 +567,7 @@ int luo_session_deserialize(void) > if (err) { > pr_warn("Failed to deserialize files for session [%s] %pe\n", > session->name, ERR_PTR(err)); > - return err; > + goto save_err; > } > } > > @@ -574,6 +576,9 @@ int luo_session_deserialize(void) > sh->ser = NULL; > > return 0; > +save_err: > + saved_err = err; > + return err; > } > > int luo_session_serialize(void) > -- > 2.43.0 > -- Sincerely yours, Mike.