From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 706275616C7; Wed, 9 Sep 2026 14:40:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964821; cv=none; b=uJgJ+xqlvrM2LeD5zIJ+N5e5ZuUwEZ6UV1nM3/bn79lpGCgT5d4xetc1EtB3wq/75OfVa2vZ7gUKPRbg1SHNh51xiOmUKs6fV+gK9FxMxje5vk6ZF/cnJ1gZ1L7JBLMjgo6N17ew4sbCzMS7FiR+D7qKsqOKKhD4J+iL/M235wg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788964821; c=relaxed/simple; bh=gXKyC7q7XVfmVyZ4JDtRRv7I5SMvyYSI/lml2/Eyh6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QwOcXoupH2BVxt/Pds+9wridPE4B864eeJoPDvJ27eLI6lN8SNVYh4E1OFkResNxGFalcUB5vjawMYbNA2TNxQrTYhN9YEj3HOzTyQFJdF/c2CkDkV2iITvnooGmoWB2yD+6Ml7dqZbdENqkojve7DcoO3TWHWZLj0je/deoA6k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DrGB02hE; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DrGB02hE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D271E1F00A3A; Wed, 9 Sep 2026 14:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788964818; bh=nXKdDDPjlhB6R1KSSRd/ybO7E07pZVa6P9RMS/f13jA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DrGB02hEvppiJ1Xthgi9PDSGDIEf4qJSrPMS5yrxbCCxRUxbfkRNGgzqB3UCa+UGP Sp0gpG1vYjNtUT7e5W9oddoyGeJJeA6zS4WIf7L1MySDrnq5AzhVjzPkDEjy7ATyHu QLPobe1YQt01m1EeTt7NtMLTB2Yr6M1phQBpTCTs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sergey Senozhatsky , Chris Mason , Brian Geffon , David Stevens , Minchan Kim , Richard Chang , Andrew Morton , Sasha Levin Subject: [PATCH 6.18 553/583] zram: fixup read_block_state() Date: Wed, 9 Sep 2026 15:43:58 +0200 Message-ID: <20260909134256.868151287@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260909134237.773280130@linuxfoundation.org> References: <20260909134237.773280130@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sergey Senozhatsky [ Upstream commit 8b05d2d8af817c6a1e23032df51e7ad83030d543 ] ac_time is now in seconds, do not use ktime_to_timespec64() [akpm@linux-foundation.org: remove now-unused local `ts'] [akpm@linux-foundation.org: fix build] Link: https://lkml.kernel.org/r/20260115033031.3818977-1-senozhatsky@chromium.org Signed-off-by: Sergey Senozhatsky Reported-by: Chris Mason Closes: https://lkml.kernel.org/r/20260114124522.1326519-1-clm@meta.com Cc: Brian Geffon Cc: David Stevens Cc: Minchan Kim Cc: Richard Chang Signed-off-by: Andrew Morton [ Stable tree note: The ac_time conversion described above is not present here, so retain the ktime_t conversion and microsecond output. Move the timespec64 temporary into the scan loop instead, allowing the follow-up bounds fix to move nr_pages initialization under init_lock cleanly. ] Stable-dep-of: 391f057f44a5 ("zram: fix out-of-bounds access in read_block_state()") Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1136,7 +1136,6 @@ static ssize_t read_block_state(struct f ssize_t index, written = 0; struct zram *zram = file->private_data; unsigned long nr_pages = zram->disksize >> PAGE_SHIFT; - struct timespec64 ts; kbuf = kvmalloc(count, GFP_KERNEL); if (!kbuf) @@ -1151,6 +1150,7 @@ static ssize_t read_block_state(struct f for (index = *ppos; index < nr_pages; index++) { int copied; + struct timespec64 ts; zram_slot_lock(zram, index); if (!zram_allocated(zram, index))