Skip to content

Commit 307fdf5

Browse files
ajstephensdavem330
authored andcommitted
tipc: Add missing spinlock in name table display code
This patch ensures that the display code that traverses the publication lists belonging to a name table entry take its associated spinlock, to protect against a possible change to one of its "head of list" pointers caused by a simultaneous name table lookup operation by another thread of control. Signed-off-by: Allan Stephens <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0f15d36 commit 307fdf5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/tipc/name_table.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct sub_seq {
7474
* @first_free: array index of first unused sub-sequence entry
7575
* @ns_list: links to adjacent name sequences in hash chain
7676
* @subscriptions: list of subscriptions for this 'type'
77-
* @lock: spinlock controlling access to name sequence structure
77+
* @lock: spinlock controlling access to publication lists of all sub-sequences
7878
*/
7979

8080
struct name_seq {
@@ -918,7 +918,9 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
918918
for (sseq = seq->sseqs; sseq != &seq->sseqs[seq->first_free]; sseq++) {
919919
if ((lowbound <= sseq->upper) && (upbound >= sseq->lower)) {
920920
tipc_printf(buf, "%s ", typearea);
921+
spin_lock_bh(&seq->lock);
921922
subseq_list(sseq, buf, depth, index);
923+
spin_unlock_bh(&seq->lock);
922924
sprintf(typearea, "%10s", " ");
923925
}
924926
}

0 commit comments

Comments
 (0)