Commit f9c9635
nilfs2: fix potential oob read in nilfs_btree_check_delete()
The function nilfs_btree_check_delete(), which checks whether degeneration
to direct mapping occurs before deleting a b-tree entry, causes memory
access outside the block buffer when retrieving the maximum key if the
root node has no entries.
This does not usually happen because b-tree mappings with 0 child nodes
are never created by mkfs.nilfs2 or nilfs2 itself. However, it can happen
if the b-tree root node read from a device is configured that way, so fix
this potential issue by adding a check for that case.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 17c76b0 ("nilfs2: B-tree based block mapping")
Signed-off-by: Ryusuke Konishi <[email protected]>
Cc: Lizhi Xu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 111b812 commit f9c9635
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1659 | 1659 | | |
1660 | 1660 | | |
1661 | 1661 | | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
1662 | 1666 | | |
1663 | 1667 | | |
1664 | 1668 | | |
1665 | 1669 | | |
1666 | 1670 | | |
1667 | 1671 | | |
1668 | | - | |
1669 | 1672 | | |
1670 | 1673 | | |
1671 | 1674 | | |
| |||
1674 | 1677 | | |
1675 | 1678 | | |
1676 | 1679 | | |
| 1680 | + | |
1677 | 1681 | | |
1678 | 1682 | | |
1679 | 1683 | | |
1680 | 1684 | | |
1681 | 1685 | | |
1682 | | - | |
1683 | 1686 | | |
1684 | 1687 | | |
1685 | 1688 | | |
| |||
0 commit comments