Skip to content

Commit a05ed4d

Browse files
committed
Merge: CVE-2024-58069: rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6528 JIRA: https://issues.redhat.com/browse/RHEL-82456 CVE: CVE-2024-58069 ``` commit 3ab8c5e Author: Oleksij Rempel <[email protected]> Date: Wed Dec 18 20:34:58 2024 +0100 rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read The nvmem interface supports variable buffer sizes, while the regmap interface operates with fixed-size storage. If an nvmem client uses a buffer size less than 4 bytes, regmap_read will write out of bounds as it expects the buffer to point at an unsigned int. Fix this by using an intermediary unsigned int to hold the value. Fixes: fadfd09 ("rtc: pcf85063: add nvram support") Signed-off-by: Oleksij Rempel <[email protected]> Signed-off-by: Ahmad Fatoum <[email protected]> Link: https://lore.kernel.org/r/20241218-rtc-pcf85063-stack-corruption-v1-1-12fd0ee0f046@pengutronix.de Signed-off-by: Alexandre Belloni <[email protected]>``` Signed-off-by: CKI Backport Bot <[email protected]> --- <small>Created 2025-03-06 17:20 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://gitlab.com/cki-project/kernel-workflow/-/issues/new?issue%5Btitle%5D=backporter%20webhook%20issue)</small> Approved-by: Daniel Horak <[email protected]> Approved-by: Tony Camuso <[email protected]> Approved-by: Lucas Zampieri <[email protected]> Approved-by: John W. Linville <[email protected]> Approved-by: Myron Stowe <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents 1f46989 + 53c5bbc commit a05ed4d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/rtc/rtc-pcf85063.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,16 @@ static const struct rtc_class_ops pcf85063_rtc_ops = {
322322
static int pcf85063_nvmem_read(void *priv, unsigned int offset,
323323
void *val, size_t bytes)
324324
{
325-
return regmap_read(priv, PCF85063_REG_RAM, val);
325+
unsigned int tmp;
326+
int ret;
327+
328+
ret = regmap_read(priv, PCF85063_REG_RAM, &tmp);
329+
if (ret < 0)
330+
return ret;
331+
332+
*(u8 *)val = tmp;
333+
334+
return 0;
326335
}
327336

328337
static int pcf85063_nvmem_write(void *priv, unsigned int offset,

0 commit comments

Comments
 (0)