aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/dbg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/dbg.c')
-rw-r--r--net/tipc/dbg.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/net/tipc/dbg.c b/net/tipc/dbg.c
index c6806910598c..834319e3b7e7 100644
--- a/net/tipc/dbg.c
+++ b/net/tipc/dbg.c
@@ -179,8 +179,10 @@ void tipc_printbuf_move(struct print_buf *pb_to, struct print_buf *pb_from)
179 } 179 }
180 180
181 if (pb_to->size < pb_from->size) { 181 if (pb_to->size < pb_from->size) {
182 tipc_printbuf_reset(pb_to); 182 strcpy(pb_to->buf, "*** PRINT BUFFER MOVE ERROR ***");
183 tipc_printf(pb_to, "*** PRINT BUFFER MOVE ERROR ***"); 183 pb_to->buf[pb_to->size - 1] = ~0;
184 pb_to->crs = strchr(pb_to->buf, 0);
185 pb_to->next = NULL;
184 return; 186 return;
185 } 187 }
186 188
@@ -405,27 +407,32 @@ struct sk_buff *tipc_log_dump(void)
405 struct sk_buff *reply; 407 struct sk_buff *reply;
406 408
407 spin_lock_bh(&print_lock); 409 spin_lock_bh(&print_lock);
408 if (!TIPC_LOG->buf) 410 if (!TIPC_LOG->buf) {
411 spin_unlock_bh(&print_lock);
409 reply = tipc_cfg_reply_ultra_string("log not activated\n"); 412 reply = tipc_cfg_reply_ultra_string("log not activated\n");
410 else if (tipc_printbuf_empty(TIPC_LOG)) 413 } else if (tipc_printbuf_empty(TIPC_LOG)) {
414 spin_unlock_bh(&print_lock);
411 reply = tipc_cfg_reply_ultra_string("log is empty\n"); 415 reply = tipc_cfg_reply_ultra_string("log is empty\n");
416 }
412 else { 417 else {
413 struct tlv_desc *rep_tlv; 418 struct tlv_desc *rep_tlv;
414 struct print_buf pb; 419 struct print_buf pb;
415 int str_len; 420 int str_len;
416 421
417 str_len = min(TIPC_LOG->size, 32768u); 422 str_len = min(TIPC_LOG->size, 32768u);
423 spin_unlock_bh(&print_lock);
418 reply = tipc_cfg_reply_alloc(TLV_SPACE(str_len)); 424 reply = tipc_cfg_reply_alloc(TLV_SPACE(str_len));
419 if (reply) { 425 if (reply) {
420 rep_tlv = (struct tlv_desc *)reply->data; 426 rep_tlv = (struct tlv_desc *)reply->data;
421 tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), str_len); 427 tipc_printbuf_init(&pb, TLV_DATA(rep_tlv), str_len);
428 spin_lock_bh(&print_lock);
422 tipc_printbuf_move(&pb, TIPC_LOG); 429 tipc_printbuf_move(&pb, TIPC_LOG);
430 spin_unlock_bh(&print_lock);
423 str_len = strlen(TLV_DATA(rep_tlv)) + 1; 431 str_len = strlen(TLV_DATA(rep_tlv)) + 1;
424 skb_put(reply, TLV_SPACE(str_len)); 432 skb_put(reply, TLV_SPACE(str_len));
425 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len); 433 TLV_SET(rep_tlv, TIPC_TLV_ULTRA_STRING, NULL, str_len);
426 } 434 }
427 } 435 }
428 spin_unlock_bh(&print_lock);
429 return reply; 436 return reply;
430} 437}
431 438