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 6F31C3E0C71 for ; Wed, 15 Apr 2026 15:42:01 +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=1776267721; cv=none; b=Kgn7eItI5cp5WfH3mQ0EX0HiUOJLYO6s3mRyPDIx8AAOFQyrtrFAJqcZIqKLTTBvOblu19JOpBNwfQ7883aKUlrJo3fUwlqiy+nQ68FGyi3n98CmggTk4RKZrpmx9egb6TaZ7dZIM5tr8EUNQJFbIF/mjAD2Xi1/A3a8+v3TlA8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776267721; c=relaxed/simple; bh=d1HM7PVn1b/sFK5Q8gbW9a2ysyVMOcGPTRDIkGOJLhc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=o6tF6FktAwsIZzuYXppXtKnP6n/RgL9gmW0y+780oou7djGFKJ+MDgOQpQKAq4uz5ul0btUuweJ7SL4yiiRi75I/fqeov3gBZF3uzhZrCzA98u16QpX9BPLXq0C5JnH9+RMkYqJ0AVZUD2azECqnCoGDj3E2fFze5Z0JgkTcXSQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kmxzwh5k; 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="kmxzwh5k" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77E53C2BCB0; Wed, 15 Apr 2026 15:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776267720; bh=d1HM7PVn1b/sFK5Q8gbW9a2ysyVMOcGPTRDIkGOJLhc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kmxzwh5kQhW8yoQvCDKk88rcmiH4uE9fYeC2UDk9u0qQTDlid6ZdbiTuY6C1SJPxR 8VKoTahMG+7Wfa02KNDWwNDLH2ab+Fq5j2j95KYHhOzDcwGIzQ8b2aB3d4oKhamDrr I/yxdAotUqD244mkORxNvGkBjyZ6BPEMOcu+MsI4rcGmVLcP7qYolN86FA2ctxTZXB zia1k18/Vfgci1uF7gKkntfQJuDGEZqBOVMVJBTcm48pAyCiVMoSKbB0yLmUm84+RM iG/9Tuoke0ifBXsV0AyJP436IRmypfFZGKf0KU1UQcxqrJp5y7JZFB/ZVj4zXkIfV6 9JDfwwOjN6Irg== Date: Wed, 15 Apr 2026 18:41:54 +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 11/11] liveupdate: fix return value on session allocation failure Message-ID: References: <20260413185127.128180-1-pasha.tatashin@soleen.com> <20260413185127.128180-12-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: <20260413185127.128180-12-pasha.tatashin@soleen.com> On Mon, Apr 13, 2026 at 06:51:27PM +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 > --- > kernel/liveupdate/luo_session.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c > index a3327a28fc1f..92b1af791889 100644 > --- a/kernel/liveupdate/luo_session.c > +++ b/kernel/liveupdate/luo_session.c > @@ -547,7 +547,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); it's really not obvious that err is global and it should be set before returning. I'd suggest replacing all return with goto that will return err; This way it should be clearer that since err is returned it should be set. > + return err; > } > > err = luo_session_insert(sh, session); > -- > 2.43.0 > -- Sincerely yours, Mike.