aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/port.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c
index c68dc956a423..3946b5b10c74 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -367,10 +367,8 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
367 imp++; 367 imp++;
368 368
369 /* discard rejected message if it shouldn't be returned to sender */ 369 /* discard rejected message if it shouldn't be returned to sender */
370 if (msg_errcode(msg) || msg_dest_droppable(msg)) { 370 if (msg_errcode(msg) || msg_dest_droppable(msg))
371 buf_discard(buf); 371 goto exit;
372 return data_sz;
373 }
374 372
375 /* construct rejected message */ 373 /* construct rejected message */
376 if (msg_mcast(msg)) 374 if (msg_mcast(msg))
@@ -378,10 +376,9 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
378 else 376 else
379 hdr_sz = LONG_H_SIZE; 377 hdr_sz = LONG_H_SIZE;
380 rbuf = tipc_buf_acquire(data_sz + hdr_sz); 378 rbuf = tipc_buf_acquire(data_sz + hdr_sz);
381 if (rbuf == NULL) { 379 if (rbuf == NULL)
382 buf_discard(buf); 380 goto exit;
383 return data_sz; 381
384 }
385 rmsg = buf_msg(rbuf); 382 rmsg = buf_msg(rbuf);
386 tipc_msg_init(rmsg, imp, msg_type(msg), hdr_sz, msg_orignode(msg)); 383 tipc_msg_init(rmsg, imp, msg_type(msg), hdr_sz, msg_orignode(msg));
387 msg_set_errcode(rmsg, err); 384 msg_set_errcode(rmsg, err);
@@ -411,9 +408,11 @@ int tipc_reject_msg(struct sk_buff *buf, u32 err)
411 tipc_net_route_msg(abuf); 408 tipc_net_route_msg(abuf);
412 } 409 }
413 410
414 /* send rejected message */ 411 /* send returned message & dispose of rejected message */
415 buf_discard(buf); 412
416 tipc_net_route_msg(rbuf); 413 tipc_net_route_msg(rbuf);
414exit:
415 buf_discard(buf);
417 return data_sz; 416 return data_sz;
418} 417}
419 418