A child node of a fixed-partitions node may lack a reg property, either because it is malformed or because it is not a partition entry at all. In that case of_get_property() returns NULL to reg, which is then dereferenced without proper checking. Fixes: 2e3a191e89f9 ("block: add support for partition table defined in OF") Cc: stable@vger.kernel.org Reviewed-by: Bartosz Golaszewski Signed-off-by: Loic Poulain --- block/partitions/of.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/partitions/of.c b/block/partitions/of.c index 53664ea06b6540e3d1155141adaafac7286f2d21..dab36513eba336344c9558d486a8915624b0fca8 100644 --- a/block/partitions/of.c +++ b/block/partitions/of.c @@ -15,6 +15,9 @@ static int validate_of_partition(struct device_node *np, int slot) int a_cells = of_n_addr_cells(np); int s_cells = of_n_size_cells(np); + if (!reg) + return -EINVAL; + /* Make sure reg len match the expected addr and size cells */ if (len / sizeof(*reg) != a_cells + s_cells) return -EINVAL; --- base-commit: fce2dfa773ced15f27dd27cd0b482a7473cdcf2a change-id: 20260717-partition-null-b05e2c956ee7 Best regards, -- Loic Poulain