mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Avi Weiss <thnkslprpt@gmail.com>
To: rafael@kernel.org
Cc: pavel@kernel.org, lenb@kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Avi Weiss <thnkslprpt@gmail.com>
Subject: [PATCH] PM: hibernate: Fix partial snapshot reads
Date: Sun, 15 Nov 2026 19:29:52 +0200	[thread overview]
Message-ID: <20261115172951.35889-2-thnkslprpt@gmail.com> (raw)

After a partial read, snapshot_read() passes the remaining page
length to simple_read_from_buffer(). The helper interprets this
length as the total buffer size and subtracts the offset again,
causing premature EOF while image data remains unread.

Pass PAGE_SIZE so the helper accounts for the offset only once.

Fixes: d3c1b24c50e8 ("PM / Hibernate: Snapshot cleanup")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 kernel/power/user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/power/user.c b/kernel/power/user.c
index 6e4f40e49319..d5e2b8d0b55b 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -154,7 +154,7 @@ static ssize_t snapshot_read(struct file *filp, char __user *buf,
 		if (res <= 0)
 			goto Unlock;
 	} else {
-		res = PAGE_SIZE - pg_offp;
+		res = PAGE_SIZE;
 	}
 
 	res = simple_read_from_buffer(buf, count, &pg_offp,

base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
-- 
2.43.0


                 reply	other threads:[~2026-11-15 17:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261115172951.35889-2-thnkslprpt@gmail.com \
    --to=thnkslprpt@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®