firewire: core: use more outbound tlabels

Tlabel is a 6 bits wide datum. Wrap it after 63 rather than 31 for more
safety against transaction label exhaustion and potential responders'
transaction layer bugs. (As noted by Guus Sliepen, this change requires
an expansion of tlabel_mask to 64 bits.)

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+6 -5
+4 -4
drivers/firewire/core-transaction.c
··· 82 list_for_each_entry(t, &card->transaction_list, link) { 83 if (t == transaction) { 84 list_del(&t->link); 85 - card->tlabel_mask &= ~(1 << t->tlabel); 86 break; 87 } 88 } ··· 288 spin_lock_irqsave(&card->lock, flags); 289 290 tlabel = card->current_tlabel; 291 - if (card->tlabel_mask & (1 << tlabel)) { 292 spin_unlock_irqrestore(&card->lock, flags); 293 callback(card, RCODE_SEND_ERROR, NULL, 0, callback_data); 294 return; 295 } 296 297 - card->current_tlabel = (card->current_tlabel + 1) & 0x1f; 298 - card->tlabel_mask |= (1 << tlabel); 299 300 t->node_id = destination_id; 301 t->tlabel = tlabel;
··· 82 list_for_each_entry(t, &card->transaction_list, link) { 83 if (t == transaction) { 84 list_del(&t->link); 85 + card->tlabel_mask &= ~(1ULL << t->tlabel); 86 break; 87 } 88 } ··· 288 spin_lock_irqsave(&card->lock, flags); 289 290 tlabel = card->current_tlabel; 291 + if (card->tlabel_mask & (1ULL << tlabel)) { 292 spin_unlock_irqrestore(&card->lock, flags); 293 callback(card, RCODE_SEND_ERROR, NULL, 0, callback_data); 294 return; 295 } 296 297 + card->current_tlabel = (card->current_tlabel + 1) & 0x3f; 298 + card->tlabel_mask |= (1ULL << tlabel); 299 300 t->node_id = destination_id; 301 t->tlabel = tlabel;
+2 -1
include/linux/firewire.h
··· 98 99 int node_id; 100 int generation; 101 - int current_tlabel, tlabel_mask; 102 struct list_head transaction_list; 103 struct timer_list flush_timer; 104 unsigned long reset_jiffies;
··· 98 99 int node_id; 100 int generation; 101 + int current_tlabel; 102 + u64 tlabel_mask; 103 struct list_head transaction_list; 104 struct timer_list flush_timer; 105 unsigned long reset_jiffies;