Skip to content

Commit fec3edc

Browse files
zijun-hurobherring
authored andcommitted
of/irq: Fix interrupt-map cell length check in of_irq_parse_imap_parent()
On a malformed interrupt-map property which is shorter than expected by 1 cell, we may read bogus data past the end of the property instead of returning an error in of_irq_parse_imap_parent(). Decrement the remaining length when skipping over the interrupt parent phandle cell. Fixes: 935df1b ("of/irq: Factor out parsing of interrupt-map parent phandle+args from of_irq_parse_raw()") Cc: stable@vger.kernel.org Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com> Link: https://lore.kernel.org/r/20241209-of_irq_fix-v1-1-782f1419c8a1@quicinc.com [rh: reword commit msg] Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
1 parent 5d009e0 commit fec3edc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/of/irq.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, struct of_ph
111111
else
112112
np = of_find_node_by_phandle(be32_to_cpup(imap));
113113
imap++;
114+
len--;
114115

115116
/* Check if not found */
116117
if (!np) {

0 commit comments

Comments
 (0)