提交 307fdf5e 编写于 作者: A Allan Stephens 提交者: David S. Miller

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: NAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0f15d364
...@@ -74,7 +74,7 @@ struct sub_seq { ...@@ -74,7 +74,7 @@ struct sub_seq {
* @first_free: array index of first unused sub-sequence entry * @first_free: array index of first unused sub-sequence entry
* @ns_list: links to adjacent name sequences in hash chain * @ns_list: links to adjacent name sequences in hash chain
* @subscriptions: list of subscriptions for this 'type' * @subscriptions: list of subscriptions for this 'type'
* @lock: spinlock controlling access to name sequence structure * @lock: spinlock controlling access to publication lists of all sub-sequences
*/ */
struct name_seq { struct name_seq {
...@@ -918,7 +918,9 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth, ...@@ -918,7 +918,9 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
for (sseq = seq->sseqs; sseq != &seq->sseqs[seq->first_free]; sseq++) { for (sseq = seq->sseqs; sseq != &seq->sseqs[seq->first_free]; sseq++) {
if ((lowbound <= sseq->upper) && (upbound >= sseq->lower)) { if ((lowbound <= sseq->upper) && (upbound >= sseq->lower)) {
tipc_printf(buf, "%s ", typearea); tipc_printf(buf, "%s ", typearea);
spin_lock_bh(&seq->lock);
subseq_list(sseq, buf, depth, index); subseq_list(sseq, buf, depth, index);
spin_unlock_bh(&seq->lock);
sprintf(typearea, "%10s", " "); sprintf(typearea, "%10s", " ");
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册