Skip to content

Commit

Permalink
firewire: core: fix invalid port index for parent device
Browse files Browse the repository at this point in the history
In a commit 24b7f8e ("firewire: core: use helper functions for self
ID sequence"), the enumeration over self ID sequence was refactored with
some helper functions with KUnit tests. These helper functions are
guaranteed to work expectedly by the KUnit tests, however their application
includes a mistake to assign invalid value to the index of port connected
to parent device.

This bug affects the case that any extra node devices which has three or
more ports are connected to 1394 OHCI controller. In the case, the path
to update the tree cache could hits WARN_ON(), and gets general protection
fault due to the access to invalid address computed by the invalid value.

This commit fixes the bug to assign correct port index.

Cc: [email protected]
Reported-by: Edmund Raile <[email protected]>
Closes: https://lore.kernel.org/lkml/[email protected]/
Fixes: 24b7f8e ("firewire: core: use helper functions for self ID sequence")
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Sakamoto <[email protected]>
  • Loading branch information
takaswie committed Oct 27, 2024
1 parent 42f7652 commit f6a6780
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/firewire/core-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static struct fw_node *build_tree(struct fw_card *card, const u32 *sid, int self
// the node->ports array where the parent node should be. Later,
// when we handle the parent node, we fix up the reference.
++parent_count;
node->color = i;
node->color = port_index;
break;

case PHY_PACKET_SELF_ID_PORT_STATUS_CHILD:
Expand Down

0 comments on commit f6a6780

Please sign in to comment.