Skip to content

Commit e8cf687

Browse files
committed
firewire: core: call handler for exclusive regions outside RCU read-side critical section
The previous commit added reference counting to ensure safe invocations of address handlers. This commit moves the invocation of handlers for exclusive regions outside of the RCU read-side critical section. The address handler for the requested region is selected within the critical section, then invoked outside of it. Link: https://lore.kernel.org/r/20250803122015.236493-3-o-takashi@sakamocchi.jp Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
1 parent 7c527c1 commit e8cf687

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/firewire/core-transaction.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -935,17 +935,19 @@ static void handle_exclusive_region_request(struct fw_card *card,
935935
scoped_guard(rcu) {
936936
handler = lookup_enclosing_address_handler(&address_handler_list, offset,
937937
request->length);
938-
if (handler) {
938+
if (handler)
939939
get_address_handler(handler);
940-
handler->address_callback(card, request, tcode, destination, source,
941-
p->generation, offset, request->data,
942-
request->length, handler->callback_data);
943-
put_address_handler(handler);
944-
}
945940
}
946941

947-
if (!handler)
942+
if (!handler) {
948943
fw_send_response(card, request, RCODE_ADDRESS_ERROR);
944+
return;
945+
}
946+
947+
// Outside the RCU read-side critical section. Without spinlock. With reference count.
948+
handler->address_callback(card, request, tcode, destination, source, p->generation, offset,
949+
request->data, request->length, handler->callback_data);
950+
put_address_handler(handler);
949951
}
950952

951953
static void handle_fcp_region_request(struct fw_card *card,

0 commit comments

Comments
 (0)