Re: [PATCH] PM: hibernate: Fix partial snapshot reads
From: Rafael J. Wysocki (Intel)
Date: Fri Nov 20 2026 - 12:28:46 EST
On Sun, Nov 15, 2026 at 6:30 PM Avi Weiss <thnkslprpt@xxxxxxxxx> wrote:
>
> 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@xxxxxxxxx>
> ---
> 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,
>
Applied as 7.5 material, thanks!