Commit ce8c3d1
committed
nvmem: core: Fix OOB read for bit offsets of more than one byte
When the bit offset is BITS_PER_BYTE or larger the read postion is
advanced by `bytes_offset`. This is not taken into account in the
per-byte read loop which still reads `cell->bytes` resuling in an out of
bounds read of `bytes_offset` bytes. The information read OOB does not
leak directly as the erroneously read bits are cleared.
Detected by KASAN while looking for a use-after-free in simplefb.c.
Fixes: 7a06ef7 ("nvmem: core: fix bit offsets of more than one byte")
Signed-off-by: Janne Grunau <[email protected]>1 parent 17e9266 commit ce8c3d1
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1618 | 1618 | | |
1619 | 1619 | | |
1620 | 1620 | | |
1621 | | - | |
| 1621 | + | |
1622 | 1622 | | |
1623 | 1623 | | |
1624 | 1624 | | |
1625 | 1625 | | |
1626 | 1626 | | |
| 1627 | + | |
| 1628 | + | |
1627 | 1629 | | |
1628 | 1630 | | |
1629 | 1631 | | |
| |||
0 commit comments